aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-02 22:19:03 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-02 22:19:03 +0200
commitad4a1e4ac6b9452bb28936623035d01bb03f36f2 (patch)
tree8126cec46695639712586926907c9464e030471f
parentc0174806a7c59cdbac1cd941d66e844e55829444 (diff)
downloadEpisodeBrowser-ad4a1e4ac6b9452bb28936623035d01bb03f36f2.tar.gz
Remember data list view height across sessions.
-rw-r--r--c/layout.h11
-rw-r--r--c/main.cpp8
-rw-r--r--pl/cfg.pl7
3 files changed, 22 insertions, 4 deletions
diff --git a/c/layout.h b/c/layout.h
index 5ea9c2b..1b78945 100644
--- a/c/layout.h
+++ b/c/layout.h
@@ -5,6 +5,7 @@
#include "common.h"
#include "datalistview.h"
+#include "pl.h"
void UpdateLayout(int w = 0, int h = 0);
@@ -44,6 +45,7 @@ inline bool Dragger::HandleDown()
if (IsDouble()) {
extern DataListView* g_dlv;
g_dlv->SetHeight(0);
+ Pl("cfg","set_dlv_height",0);
UpdateLayout();
return false;
} else
@@ -62,10 +64,13 @@ inline bool Dragger::HandleMove()
SetCursor(g_hcSizeNs);
else
r = false;
- if (m_bActive)
- Drag(pt.x, pt.y);
- if (!IsDown())
+ if (!m_bActive) return r;
+ Drag(pt.x, pt.y);
+ if (!IsDown()) {
+ extern DataListView* g_dlv;
m_bActive = false;
+ Pl("cfg","set_dlv_height",g_dlv->Height());
+ }
return r;
}
diff --git a/c/main.cpp b/c/main.cpp
index 477e750..d76225e 100644
--- a/c/main.cpp
+++ b/c/main.cpp
@@ -193,11 +193,17 @@ static LRESULT CALLBACK CBTProc(const int nCode, const WPARAM wParam, const LPAR
g_elv = new EpisodeListView(g_hWnd);
/* Get saved view settings. */
- char* s;
Pl("cfg","get_view_watched",&g_bViewWatched);
Pl("cfg","get_view_tv_original",&g_bViewTVOriginal);
+
+ char* s;
if (Pl("cfg","get_limit_screenwriter",&s))
strcpy_s(g_currentScreenwriter, sizeof(g_currentScreenwriter), s);
+
+ int dlvHeight = 0;
+ Pl("cfg","get_dlv_height",&dlvHeight);
+ g_dlv->SetHeight(dlvHeight);
+
return 0;
}
diff --git a/pl/cfg.pl b/pl/cfg.pl
index 54b5544..297d426 100644
--- a/pl/cfg.pl
+++ b/pl/cfg.pl
@@ -67,3 +67,10 @@ get_focus(V) :-
integer(V), !
; V = 1
).
+
+set_dlv_height(V) :- set_key('DlvHeight', V).
+get_dlv_height(V) :-
+ ( get_key('DlvHeight', V),
+ integer(V), !
+ ; V = 0
+ ).