9049b866600b — Josef 'Jeff' Sipek v0.22 2 months ago
hlog: display a short recent contact list for the current call

Split the space used by the recent contacts list into two sections - a 5
line section showing the recent contacts for the call currently being worked
on, and the remainder for the last N contacts regardless of call.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
3 files changed, 25 insertions(+), 1 deletions(-)

M hlog/contest.c
M hlog/contest/contest.h
M hlog/contest/ui-work.c
M hlog/contest.c +19 -1
@@ 85,8 85,12 @@ 
 #define STATUS_WIN_WIDTH	CURRENT_WIN_WIDTH
 #define STATUS_WIN_ROW		(WORK_WIN_ROW + WORK_WIN_HEIGHT)
 #define STATUS_WIN_COL		0
+#define RECENT_WORK_WIN_WIDTH	CURRENT_WIN_WIDTH
+#define RECENT_WORK_WIN_ROW	(STATUS_WIN_ROW + STATUS_WIN_HEIGHT)
+#define RECENT_WORK_WIN_COL	0
+#define RECENT_WORK_WIN_HEIGHT	5
 #define RECENT_WIN_WIDTH	CURRENT_WIN_WIDTH
-#define RECENT_WIN_ROW		(STATUS_WIN_ROW + STATUS_WIN_HEIGHT)
+#define RECENT_WIN_ROW		(RECENT_WORK_WIN_ROW + RECENT_WORK_WIN_HEIGHT + 1)
 #define RECENT_WIN_COL		0
 #define RECENT_WIN_HEIGHT	(CURRENT_WIN_ROW - RECENT_WIN_ROW)
 

          
@@ 124,6 128,7 @@ static LOCK_CLASS(rig_lc);
 
 static WINDOW *header_win; /* location & time */
 static WINDOW *supercheck_win;
+struct recent recent_work_list; /* current contact history */
 struct recent recent_list; /* all history */
 
 /* the currently active form */

          
@@ 436,6 441,10 @@ static void setup_windows(void)
 		CALLOUT_WIN_COL - 1, CALLOUT_WIN_WIDTH + 2,
 		ACS_LLCORNER, ACS_HLINE, ACS_RTEE);
 
+	/* recent lists separator */
+	xwhline(stdscr, RECENT_WIN_ROW - 1, 0, RECENT_WIN_WIDTH + 1,
+		ACS_HLINE, ACS_HLINE, ACS_RTEE);
+
 	wrefresh(stdscr); /* refresh all the lines */
 
 	/* header with status */

          
@@ 470,6 479,12 @@ static void setup_windows(void)
 			  ERROR_COLOR);
 	ASSERT0(ret);
 
+	/* recent QSOs for current call */
+	ret = recent_init(&recent_work_list, RECENT_WORK_WIN_HEIGHT,
+			  RECENT_WORK_WIN_WIDTH, RECENT_WORK_WIN_ROW,
+			  RECENT_WORK_WIN_COL, false);
+	recent_refresh(&recent_work_list, NULL);
+
 	/* recent QSOs */
 	ret = recent_init(&recent_list, RECENT_WIN_HEIGHT, RECENT_WIN_WIDTH,
 			  RECENT_WIN_ROW, RECENT_WIN_COL, true);

          
@@ 488,6 503,7 @@ static void refresh_windows(void)
 	wrefresh(supercheck_win);
 	xform_refresh(&work);
 	status_refresh();
+	recent_refresh(&recent_work_list, qso_get_station_call(&contact->rx));
 	recent_refresh(&recent_list, NULL);
 	xform_refresh(&current);
 

          
@@ 637,6 653,7 @@ static int do_contest(lua_State *L)
 		draw_location();
 		draw_clock();
 
+		recent_refresh(&recent_work_list, qso_get_station_call(&contact->rx));
 		recent_refresh(&recent_list, NULL);
 		sync_current();
 		refresh_windows();

          
@@ 648,6 665,7 @@ static int do_contest(lua_State *L)
 	delwin(header_win);
 	callout_destroy();
 	delwin(supercheck_win);
+	recent_destroy(&recent_work_list);
 	recent_destroy(&recent_list);
 	status_deinit();
 

          
M hlog/contest/contest.h +1 -0
@@ 40,6 40,7 @@ struct contest_params {
  */
 extern struct xform work; /* current QSO contest exchange */
 extern struct xform current; /* current QSO in full */
+extern struct recent recent_work_list; /* current contact history */
 extern struct recent recent_list; /* all history */
 
 /*

          
M hlog/contest/ui-work.c +5 -0
@@ 180,28 180,33 @@ void ui_work_dispatch(lua_State *L, int 
 		case 127:
 			xform_driver(form, XFORM_REQ_DEL_PREV);
 			field_changed(L, *qso); /* inform script */
+			recent_invalidate(&recent_work_list);
 			break;
 
 		case KEY_DC:
 			xform_driver(form, XFORM_REQ_DEL_THIS);
 			field_changed(L, *qso); /* inform script */
+			recent_invalidate(&recent_work_list);
 			break;
 
 		/* navigate between forms */
 		case KEY_ENTER:
 		case '\n':
 			end_qso(L, qso);
+			recent_invalidate(&recent_work_list);
 			recent_invalidate(&recent_list);
 			break;
 
 		case '\x1b': /* escape */
 			abort_qso(L, qso);
+			recent_invalidate(&recent_work_list);
 			break;
 
 		default:
 			if (!iscntrl(ch)) {
 				xform_driver(form, ch);
 				field_changed(L, *qso); /* inform script */
+				recent_invalidate(&recent_work_list);
 			} else {
 				beep();
 			}