Example #1
0
four_back()
{
 if(FOUR_HERE){
   set_browser_data(my_four,1);
   /*   my_browser.data=my_four;
	my_browser.col0=1; */
   refresh_browser(four_len);
 }
}
Example #2
0
hist_back()
{
 if(HIST_HERE){
   set_browser_data(my_hist,1);
   /*
   my_browser.data=my_hist;
   my_browser.col0=1; */
   refresh_browser(hist_len);
 }
}
Example #3
0
File: cmod.c Project: imclab/cmod
void repaint_windows()
{
  int begin_pos = 0;

  begin_pos = (p_b / (browser_win->_maxy - 1)) * (browser_win->_maxy - 1);
  refresh_browser(NULL, begin_pos);

  begin_pos = (p_p / (playlist_win->_maxy - 1)) * (playlist_win->_maxy - 1);
  refresh_playlist(begin_pos);

}
Example #4
0
cont_integ()
{
  double tetemp;
  double *x;
  double dif;
  if(INFLAG==0||FFT!=0||HIST!=0)return;
  tetemp=TEND;
  wipe_rep();
  data_back();
  if(new_float("Continue until:",&tetemp)==-1)return;
  x=&MyData[0];
  tetemp=fabs(tetemp);
  if(fabs(MyTime)>=tetemp)return;
  dif=tetemp-fabs(MyTime);
  /* TEND=tetemp; */
  MyStart=1;  /*  I know it is wasteful to restart, but lets be safe.... */
  integrate(&MyTime,x,dif,DELTA_T,1,NJMP,&MyStart);
  ping();
  refresh_browser(storind);
}
Example #5
0
File: cmod.c Project: imclab/cmod
int main(int argc, char *argv[])
{
  char *buff;
  int ch;
  int i;

  initscr();
  cbreak();
  noecho();
  nonl();
  curs_set(0);
  // nodelay(stdscr, TRUE);
  intrflush(stdscr, FALSE);
  keypad(stdscr, TRUE);

  if((color = has_colors())) {
    start_color();
    init_pair(1, COLOR_WHITE, COLOR_BLUE);
    init_pair(2, COLOR_CYAN, COLOR_BLUE);
  }

  signal(SIGINT, cleanup);

  init_windows();
  init_bass();

  create_playlist(&playlist_h, &playlist_t);

  if(argc>1) {
    if(strncmp("/", argv[1], 1) != 0) {
      error("argument must be an absolute path", FALSE);
    }
    if(dirname(opendir(argv[1]))) { // is a dir
      if(add(&playlist_h, argv[1], &playlist_t)) {
        p_p++;
        c_p_p++;
        nsongs++;
        active_win = PLAYLIST_WIN;
        bass_loop = BASS_MUSIC_LOOP;
        play(argv[1], PLAYING_PLAYLIST);
      }
      current_path = strdup((char*)dirname(argv[1]));
    } else {
      error("argument not valid", FALSE);
    }
  } else {
    current_path = (char*)malloc(sizeof(char)*PATH_MAX);
    current_path = (char*)getcwd(current_path, PATH_MAX);
  }

  entries = refresh_browser(current_path, 0);

  mvprintw(0, 0, "%s", current_path);

  repaint_windows();

  while((ch = getch()) != 'q') {
    switch(ch) {
      case 'a': // add song to playlist
          if(active_win == BROWSER_WIN) {
            if(!is_dir(current_path, entries[p_b])) {
              buff = mystrcat(current_path,entries[p_b],1);
              if(add(&playlist_h, buff, &playlist_t)) {
                if(p_p == -1) p_p++;
                nsongs++;
                repaint_windows();
              }
              free(buff);
            }
          }
        break;
      case 'e': // add all songs in current dir
          if(active_win == BROWSER_WIN) {
            for(i=0; i<nfiles; i++) {
              if(!is_dir(current_path, entries[i])) {
                buff = mystrcat(current_path,entries[i],1);
                if(add(&playlist_h, buff, &playlist_t)) {
                  if(p_p == -1) p_p++;
                  nsongs++;
                }
                free(buff);
              }
            }
          }
          repaint_windows();
        break;
      case 'c': // recursive add
          if(active_win == BROWSER_WIN) {
            //printw("---%s+++", current_path);
            add_recursive(current_path, entries, nfiles);
            repaint_windows();
            //printw("---%s", current_path);
          }
        break;
      case 'd': // remove one song from playlist
          if(active_win == PLAYLIST_WIN) {
            if(del(&playlist_h, p_p, &playlist_t)) {
              nsongs--;
              if(p_p > nsongs - 1) {
                p_p = nsongs - 1;
              }
              if(p_p < c_p_p) {
                c_p_p--;
              }
              //stop();
              repaint_windows();
            }
          }
        break;
      case 'r': // remove all songs from playlist
          if(del_all(&playlist_h, &playlist_t)) {
            p_p = -1;
            c_p_p = -1;
            nsongs = 0;
            repaint_windows();
          }
        break;
      case ' ': // start playback or browse filesystem
      case 13: //enter key
          if(active_win == BROWSER_WIN) {
            if(strcmp(entries[p_b], "..\0") == 0) {
              current_path = dirname(current_path);
              p_b = 0;
              entries = refresh_browser(current_path, 0);
            } else {
              if(is_dir(current_path, entries[p_b])) {
                current_path = dir_up(current_path, entries[p_b]);
                p_b = 0;
                entries = refresh_browser(current_path, 0);
              } else {
                buff = mystrcat(current_path,entries[p_b],1);
                play(buff, PLAYING_BROWSER);
                free(buff);
                c_p_p = -1;
                if(p_b < nfiles-1) {
                  p_b++;
                }
              }
            }
            refresh_path();
          } else { // PLAYLIST_WIN
            if(nsongs != 0) {
              play(get(&playlist_h, p_p, &playlist_t)->file, PLAYING_PLAYLIST);
              c_p_p = p_p;
              if(p_p < nsongs - 1) {
                p_p++;
              }
            }
          }
          repaint_windows();
        break;

      case 's': // stop playback
          stop();
          c_p_p = -1;
          repaint_windows();
          clear_statusbar(NULL);
        break;

      case 'n': // next song
          next();
        break;

      case 'p': // prev song
          prev();
        break;

      case 'g': // go to current song
          p_p = c_p_p;
          repaint_windows();
        break;

      case 'l': // toggle loop
          loop();
          stop();
          c_p_p = -1;
          repaint_windows();
        break;

      case 'z': // toggle random
          random_mode();
        break;

      case '.': // seek forward
          seek(1);
        break;

      case ',': // seek backward
          seek(-1);
        break;

      case '+':
          volume_up();
        break;

      case '-':
          volume_down();
        break;

      case '>':
          amplify_up();
        break;

      case '<':
          amplify_down();
        break;

      case KEY_UP:
        if(active_win == BROWSER_WIN) {
          if(p_b > 0) {
            p_b--;
          }
        } else {
          if(p_p > 0) {
            p_p--;
          }
        }
        repaint_windows();
        break;

      case KEY_DOWN:
        if(active_win == BROWSER_WIN) {
          if(p_b < nfiles-1) {
            p_b++;
          }
        } else {
          if(p_p < nsongs - 1) {
            p_p++;
          }
        }
        repaint_windows();
        break;

      case KEY_LEFT:
      case KEY_RIGHT:
          switch_activewindow();
          repaint_windows();
        break;

      case KEY_HOME:
          if(active_win == BROWSER_WIN) {
            p_b = 0;
          } else {
            if(p_p != -1) p_p = 0;
          }
          repaint_windows();
        break;

      case KEY_END:
          if(active_win == BROWSER_WIN) {
            p_b = nfiles-1;
          } else {
            if(p_p != -1) p_p = nsongs - 1;
          }
          repaint_windows();
        break;

      case KEY_NPAGE:
        if(active_win == BROWSER_WIN) {
          if((p_b + (browser_win->_maxy - 2)) < nfiles-1 ) {
            p_b += browser_win->_maxy - 1;
          } else {
            p_b = nfiles-1;
          }
        } else {
          if((p_p + (playlist_win->_maxy - 2)) < nsongs) {
            p_p += playlist_win->_maxy - 1;
          } else {
            p_p = nsongs - 1;
          }
        }
        repaint_windows();
        break;

      case KEY_PPAGE:
        if(active_win == BROWSER_WIN) {
          if((p_b - (browser_win->_maxy - 2)) > 0) {
            p_b -= browser_win->_maxy - 1;
          } else {
            p_b = 0;
          }
        } else {
          if((p_p - (playlist_win->_maxy - 2)) > 0) {
            p_p -= playlist_win->_maxy - 1;
          } else {
            if(p_p != -1) p_p = 0;
          }
        }
        repaint_windows();
        break;
    }

    //usleep(10);

    //update_status();

  }

  cleanup();

  return 0;

}