]> git.mdlowis.com Git - archive/afm.git/commitdiff
merge changes from master
authora bellenir <a@bellenir.com>
Thu, 24 Jul 2014 03:01:59 +0000 (03:01 +0000)
committera bellenir <a@bellenir.com>
Thu, 24 Jul 2014 03:01:59 +0000 (03:01 +0000)
1  2 
source/main.c
source/screen.c
source/screen.h
source/workdir.h

diff --cc source/main.c
index bbbbb28b6d2316f425c81007b93cebfd2ec0e9db,ad5aa237a79f71c97463fcfad70ce55e2c314e6c..c745e51e1d0b935ffa8dee337ef7576cecd4a55b
@@@ -37,8 -36,6 +36,7 @@@ int main(int argc, char** argv) 
      erase();
      refresh();
      endwin();
-     workdir_deinit();
 +    screen_deinit();
      return 0;
  }
  
diff --cc source/screen.c
index e5bfc06036050468eae90e0f7f12bda50739fdd1,5a51c05fde67d3269105edd040319bc303360b80..e47d868ddb7d7c39d592951f9db51e22dff99ce9
@@@ -1,28 -1,30 +1,38 @@@
- #include "screen.h"
- #include "state.h"
- #include "aardvark.h"
- #include "workdir.h"
+ /* external libraries */
  #include <ncurses.h>
+ #include <unistd.h>
+ #include <stdio.h>
+ /* internal libraries */
+ #include "vec.h"
 +#include "list.h"
  #include "mem.h"
  
- typedef struct {
-     WINDOW* p_win;
- } frame_t;
+ /* internal headers */
+ #include "screen.h"
+ #include "state.h"
+ #include "aardvark.h"
+ #include "workdir.h"
  
  static void screen_place_windows(void);
  static frame_t* screen_frame_new(void);
  static void screen_frame_free(void* p_frame);
+ void screen_frame_draw_files(frame_t* frame);
  
 -static frame_t* Master;
 -static vec_t* Screen_List;
 +static list_t* Screen_List;
 +
++frame_t* master_frame(void){
++      return (frame_t*) Screen_List->head->contents;
++}
  void screen_init(void) {
 -    Master = screen_frame_new();
 -    Screen_List = vec_new(0);
 -    state_set_focused_frame(Master);
 +    Screen_List = list_new();
 +    list_push_back(Screen_List, screen_frame_new());
++    state_set_focused_frame(master_frame());
 +}
 +
 +void screen_deinit(void) {
 +    mem_release(Screen_List);
  }
  
  void screen_update(void) {
@@@ -57,10 -55,11 +67,11 @@@ static void screen_place_windows(void) 
      getmaxyx(stdscr, lines, cols);
  
      /* Print the master frame */
 -    p_frame = Master;
 +    p_frame = list_at(Screen_List,0)->contents;
      mvwin(p_frame->p_win, 0, 0);
 -    wresize(p_frame->p_win, lines, (vec_size(Screen_List) > 0) ? cols/2 : cols);
 +    wresize(p_frame->p_win, lines, (num_frames > 1) ? cols/2 : cols);
      wclear(p_frame->p_win);
+     screen_frame_draw_files(p_frame);
      box(p_frame->p_win, 0 , 0);
      wrefresh(p_frame->p_win);
  
          mvwin(p_frame->p_win, pos, cols/2);
          wresize(p_frame->p_win, height, cols/2);
          wclear(p_frame->p_win);
+               screen_frame_draw_files(p_frame);
          wmove(p_frame->p_win, 1, 1);
 -        wprintw(p_frame->p_win, "(%d, %d)", i*height, cols/2);
          box(p_frame->p_win, 0 , 0);
          wrefresh(p_frame->p_win);
 +        /* Get the next one */
 +        id++;
          pos += height;
 +        p_node = p_node->next;
      }
  }
  
diff --cc source/screen.h
index 5e40eedb05f6b86d41daad44f9db38b6eaa86c4a,ff017f62b3cffd69e59e094d6a1313648fe93b13..3a4829211086d51ce0557e8e8f8939d0a8c20fcb
@@@ -7,8 -7,10 +7,11 @@@
  #ifndef SCREEN_H
  #define SCREEN_H
  
+ #include <ncurses.h>
+ #include "workdir.h"
  void screen_init(void);
 +void screen_deinit(void);
  void screen_update(void);
  void screen_open(void);
  void screen_close(void);
index 0b3afd6057c67b4b2d049ba846b58f78ad52c691,6b57347f41ac954d236ca2add291cc3b6b2cec53..ead09947327fc7a31167c5a805b7857cd1011394
@@@ -7,16 -7,23 +7,25 @@@
  #ifndef WORKDIR_H
  #define WORKDIR_H
  
- void workdir_init(int windex);
+ #include "vec.h"
  
- void workdir_prev(void);
 +void workdir_deinit(void);
 +
+ typedef struct {
+     int idx;
+     char* path;
+     vec_t* vfiles;
+     int top_index;
+ } WorkDir_T;
  
void workdir_next(void);
WorkDir_T* workdir_new(char* path);
  
- void workdir_cd(void);
+ void workdir_prev(WorkDir_T*);
  
- void workdir_ls(void);
+ void workdir_next(WorkDir_T*);
+ void workdir_cd(WorkDir_T*);
+ void workdir_ls(WorkDir_T*);
  
  #endif /* WORKDIR_H */