window_e and window_t added
wins_slct_init(), wins_slctd_set(), wins_slctd_next() and wins_slctd() created
This commit is contained in:
parent
6ad12276c4
commit
5cc85f48ab
53
src/wins.c
53
src/wins.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: wins.c,v 1.1 2007/07/21 19:37:44 culot Exp $ */
|
/* $Id: wins.c,v 1.2 2007/07/23 19:28:37 culot Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calcurse - text-based organizer
|
* Calcurse - text-based organizer
|
||||||
@ -35,6 +35,39 @@
|
|||||||
#include "todo.h"
|
#include "todo.h"
|
||||||
#include "wins.h"
|
#include "wins.h"
|
||||||
|
|
||||||
|
static window_e slctd_win;
|
||||||
|
|
||||||
|
/* Initialize the selected window in calcurse's interface. */
|
||||||
|
void
|
||||||
|
wins_slctd_init(void)
|
||||||
|
{
|
||||||
|
wins_slctd_set(CALENDAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Returns an enum which corresponds to the window which is selected. */
|
||||||
|
window_e
|
||||||
|
wins_slctd(void)
|
||||||
|
{
|
||||||
|
return (slctd_win);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sets the selected window. */
|
||||||
|
void
|
||||||
|
wins_slctd_set(window_e window)
|
||||||
|
{
|
||||||
|
slctd_win = window;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TAB key was hit in the interface, need to select next window. */
|
||||||
|
void
|
||||||
|
wins_slctd_next(void)
|
||||||
|
{
|
||||||
|
if (slctd_win == TODO)
|
||||||
|
slctd_win = CALENDAR;
|
||||||
|
else
|
||||||
|
slctd_win++;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create all the windows. */
|
/* Create all the windows. */
|
||||||
void
|
void
|
||||||
wins_init(window_t *wincal, window_t *winapp, window_t *wintod,
|
wins_init(window_t *wincal, window_t *winapp, window_t *wintod,
|
||||||
@ -71,7 +104,7 @@ wins_init(window_t *wincal, window_t *winapp, window_t *wintod,
|
|||||||
* size and placement.
|
* size and placement.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
wins_reinit(conf_t *conf, int which_pan, window_t *winbar, window_t *winapp,
|
wins_reinit(conf_t *conf, window_t *winbar, window_t *winapp,
|
||||||
window_t *wintod, window_t *wincal, window_t *winnot)
|
window_t *wintod, window_t *wincal, window_t *winnot)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
@ -217,11 +250,11 @@ wins_get_config(conf_t *conf, window_t *status, window_t *notify,
|
|||||||
* selected window.
|
* selected window.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
wins_update(int surrounded_window, conf_t *conf, window_t *winbar,
|
wins_update(conf_t *conf, window_t *winbar, window_t *winapp, window_t *wintod,
|
||||||
window_t *winapp, window_t *wintod, int hilt_app, int hilt_tod,
|
int hilt_app, int hilt_tod, int nb_tod, int first_todo_onscreen,
|
||||||
int which_pan, int nb_tod, int first_todo_onscreen, char *saved_t_mesg)
|
char **saved_t_mesg)
|
||||||
{
|
{
|
||||||
switch (surrounded_window) {
|
switch (slctd_win) {
|
||||||
|
|
||||||
case CALENDAR:
|
case CALENDAR:
|
||||||
border_color(cwin);
|
border_color(cwin);
|
||||||
@ -248,11 +281,11 @@ wins_update(int surrounded_window, conf_t *conf, window_t *winbar,
|
|||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
apoint_update_panel(winapp, hilt_app, which_pan);
|
apoint_update_panel(winapp, hilt_app, slctd_win);
|
||||||
todo_update_panel(wintod, hilt_tod, nb_tod, which_pan,
|
todo_update_panel(wintod, hilt_tod, nb_tod, slctd_win,
|
||||||
first_todo_onscreen, &saved_t_mesg);
|
first_todo_onscreen, saved_t_mesg);
|
||||||
calendar_update_panel(cwin);
|
calendar_update_panel(cwin);
|
||||||
status_bar(surrounded_window);
|
status_bar();
|
||||||
if (notify_bar())
|
if (notify_bar())
|
||||||
notify_update_bar();
|
notify_update_bar();
|
||||||
wmove(swin, 0, 0);
|
wmove(swin, 0, 0);
|
||||||
|
33
src/wins.h
33
src/wins.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: wins.h,v 1.1 2007/07/21 19:37:44 culot Exp $ */
|
/* $Id: wins.h,v 1.2 2007/07/23 19:28:37 culot Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calcurse - text-based organizer
|
* Calcurse - text-based organizer
|
||||||
@ -29,13 +29,34 @@
|
|||||||
|
|
||||||
#include "vars.h"
|
#include "vars.h"
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CALENDAR,
|
||||||
|
APPOINTMENT,
|
||||||
|
TODO,
|
||||||
|
NOTIFY,
|
||||||
|
STATUS,
|
||||||
|
NBWINS
|
||||||
|
} window_e;
|
||||||
|
|
||||||
|
/* Window properties */
|
||||||
|
typedef struct {
|
||||||
|
unsigned w; /* width */
|
||||||
|
unsigned h; /* height */
|
||||||
|
int x; /* x position */
|
||||||
|
int y; /* y position */
|
||||||
|
} window_t;
|
||||||
|
|
||||||
|
void wins_slctd_init(void);
|
||||||
|
window_e wins_slctd(void);
|
||||||
|
void wins_slctd_set(window_e);
|
||||||
|
void wins_slctd_next(void);
|
||||||
void wins_init(window_t *, window_t *, window_t *, window_t *);
|
void wins_init(window_t *, window_t *, window_t *, window_t *);
|
||||||
void wins_reinit(conf_t *conf, int, window_t *, window_t *, window_t *,
|
void wins_reinit(conf_t *conf, window_t *, window_t *, window_t *,
|
||||||
window_t *, window_t *);
|
window_t *, window_t *);
|
||||||
void wins_show(WINDOW *, char *);
|
void wins_show(WINDOW *, char *);
|
||||||
void wins_get_config(conf_t *conf, window_t *, window_t *, window_t *,
|
void wins_get_config(conf_t *conf, window_t *, window_t *,
|
||||||
window_t *, window_t *);
|
window_t *, window_t *, window_t *);
|
||||||
void wins_update(int surrounded_window, conf_t *conf, window_t *,
|
void wins_update(conf_t *conf, window_t *, window_t *, window_t *,
|
||||||
window_t *, window_t *, int, int, int, int, int, char *);
|
int, int, int, int, char **);
|
||||||
|
|
||||||
#endif /* CALCURSE_WINS_H */
|
#endif /* CALCURSE_WINS_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user