// Copyright 2003 Regents of the University of California

// Astropulse 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 2, or (at your option) any later
// version.

// Astropulse 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 Astropulse; see the file COPYING.  If not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

/* ap_graphics.h */
/* Header file for AstroPulse graphics */

#ifndef AP_GRAPHICS_H
#define AP_GRAPHICS_H

#include "astropulse.h"
#include "gdata.h"
#include "gutil.h"
#include "reduce.h"
#include "boinc_api.h"
#include "graphics2.h"
#include "ap_gfx_base.h"
#include "graphics_data.h"


extern void renderBitmapString(float x, float y, void *font, char *string);
extern void ap_gfx_init(void);


class AP_GRAPHICS: public AP_GRAPHICS_BASE {
    double roll_theta;
    double pitch_theta;
    float text1_pos[3];
    float text2_pos[3];
    float text3_pos[3];
    float icon_pos1[3];// = {.05,.2,0}; //top left
    float icon_pos2[3];// = {.2,.05,0}; //bottom right
    MOVING_TEXT_PANEL text_panels[3];
    RIBBON_GRAPH time_series_graph;
    PROGRESS_2D total_progress;  // outer progress for 2D display
    PROGRESS outer_progress;
    void get_data_info_string(char*);
    void get_user_info_string(char*);
    void draw_time_graph();
    void get_analysis_info_string(char*);
    void init_text_panels();
    void draw_ap_bars(double);
    void render_pillars(double, double);
    void render_panels(double, double);
    void render_headsup(double, double);
    // sah also has: PROGRESS inner_progress
    // 		     int choose_signal_to_display
  public:
    Astropulse::time_series_f_t time_series;
    void worker_thread_init();
    void graphics_thread_init();
    void reread_prefs();
    void setup_given_prefs();
    void resize(int, int);
    void render(int x, int y, double t);
};

extern AP_GRAPHICS ap_graphics;

#endif // AP_GRAPHICS_H
