]> Pileus Git - lackey/blobdiff - src/view.h
Move main loop and curses init to view
[lackey] / src / view.h
index b72249bf2769594bd153cca1eaf0759a7ab2068d..b896beaffb8dd048f69a7a8a776015991cadd336 100644 (file)
@@ -1,16 +1,16 @@
 /*
- * Copyright (C) 2012 Andy Spencer <andy753421@gmail.com>
- * 
+ * Copyright (C) 2012-2013 Andy Spencer <andy753421@gmail.com>
+ *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #define COLOR_WORK  8
 #define COLOR_OTHER 9
 
-/* Helper functions */
-void event_box(WINDOW *win, event_t *event, int y, int x, int h, int w);
-void event_line(WINDOW *win, event_t *event, int y, int x, int w, int full);
-void todo_line(WINDOW *win, todo_t *todo, int y, int x, int w, int full);
+/* Display flags */
+#define SHOW_DETAILS 0x1
+#define SHOW_ACTIVE  0x2
 
-/* View functions */
-void view_init(void);
-void view_resize(void);
-void view_draw(void);
-int  view_run(int key, mmask_t btn, int row, int col);
+/* Edit modes */
+typedef enum {
+       EDIT_NONE,
+       EDIT_CAL,
+       EDIT_EVENT,
+       EDIT_TODO,
+} edit_t;
+
+/* Config data */
+extern int COMPACT; // reduce layout spacing
+extern int MORNING; // first line to display
 
-/* View init functions */
-void day_init(WINDOW *win);
-void week_init(WINDOW *win);
-void month_init(WINDOW *win);
-void year_init(WINDOW *win);
-void events_init(WINDOW *win);
-void todo_init(WINDOW *win);
-void settings_init(WINDOW *win);
-void help_init(WINDOW *win);
+/* Global data */
+extern edit_t EDIT; // edit mode 0=cal 1=event 3=todo
 
-/* View size functions */
-void day_size(int,int);
-void week_size(int,int);
-void month_size(int,int);
-void year_size(int,int);
-void events_size(int,int);
-void todo_size(int,int);
-void settings_size(int,int);
-void help_size(int,int);
+/* Curses typedefs */
+typedef struct _win_st WINDOW;
 
-/* View draw functions */
-void day_draw(void);
-void week_draw(void);
-void month_draw(void);
-void year_draw(void);
-void events_draw(void);
-void todo_draw(void);
-void settings_draw(void);
-void help_draw(void);
+/* Curses functions */
+void wmvresize(WINDOW *win, int top, int left, int rows, int cols);
+void wshrink(WINDOW *win, int top);
 
-/* View run functions */
-int day_run(int,mmask_t,int,int);
-int week_run(int,mmask_t,int,int);
-int month_run(int,mmask_t,int,int);
-int year_run(int,mmask_t,int,int);
-int events_run(int,mmask_t,int,int);
-int todo_run(int,mmask_t,int,int);
-int settings_run(int,mmask_t,int,int);
-int help_run(int,mmask_t,int,int);
+/* Helper functions */
+void event_box(WINDOW *win, event_t *event, int y, int x, int h, int w);
+void event_line(WINDOW *win, event_t *event, int y, int x, int w, int flags);
+void todo_line(WINDOW *win, todo_t *todo, int y, int x, int w, int flags);
+
+/* View functions */
+void view_init(void);
+void view_main(void);
+void view_exit(void);
+void view_config(const char *group, const char *name, const char *key, const char *value);
+void view_edit(edit_t mode);