// $Header: /home/rwg/.CVS/software/spscan/src/spec_display.h,v 1.9 2002/03/06 23:45:20 rwg Exp $ // spec_display.h: classes needed to display spectra, slices ... #ifndef _H_SPECDISP_ #define _H_SPECDISP_ #include "peaks.h" #include "assignment.h" #include "spscan.h" class palette_popup; // in spec_win.cc class cursor_window; class spec_window; class spec_group; class spec_access; class strip_spec_3D; class spec_display; class ls_window; // in lswin.cc class ls_tool; // in check.cc class tool_ls_window; class tool_spec_window; class check_tool; class check_ls_window; class NOAH_ls_window; class NOAH_tool; class ass_pos; class NOAH_list; class ecosy_ls_window; // in check.cc class ecosy_spec_window; class ecosy_tool; class draw_obj; class draw_list; class draw_peak; class draw_shape; class shift_draw_shape; class draw_box; class draw_line; class coupl_entry; // defined in check.cc class coupl_list; class indirect_entry_list; class strip_check; class strip_check_chd; class inf_tool; class level_list; // in spec_win.h class color_display; // in spec_win.cc #define OutOfPlaneColor 3 // orange #define SelectedColor 4 // blue #define NR_SPEC_COLORS 64 #define SWLW 3.0 // strip width / linewidth // extern class cSpec; // in spec_win.cc class color_popup : public main_window { public: XColor *color_cells; unsigned int *color_cellsT; scrollbar *smin, *smax; int ncolors; color_display *cdf; color_popup(int ncol, XColor *cells, unsigned int *cellsT); void paint(); void inv(void) { scheme++; paint(); } private: bool invx; char scheme; }; // spectral display // coordinate window which is not a pixmap_window, full area // status of status_i: #define ChangePlane 0x01 #define ChAlways 0x02 // draw crosshair independent of plane #define CURSOR_WINDOW 310 #define LS_WIN 311 #define SPEC_WIN 314 #define RD_SPEC_WIN 315 class cursor_window : public window { public: int type; bool updated; // window has caused group update bool follow_ch; // if crosshair moved out of window, center. draw_list * to_draw; float xl,yd; // WK left, down (ppm) float xr,yu; // WK right, up (ppm) float oxl, oxr, oyd, oyu; // size before zoom float xf,yf; // ppm*xf=window coord int xc, yc, // current window coordinates (internal use) xch, ych; // crosshair coordinates (window) int xi, yi; // start of motion int pg[DIMENSION+1]; // perm of x/y/indirect dimensions in group // perm <0 means inactive int dim; // number of dimensions including indirect int plane[DIMENSION]; // position in spectrum in indirect dims float ppm_i[DIMENSION]; // ppm in indirect dims float o_ppm_i[DIMENSION]; // last ppm_i from show float thick_i[DIMENSION]; // ppm range for ch and peaks in indirect dims signed char status_i[DIMENSION]; // whether cursor out of plane causes plane change, ... //valid entries in plane = dim-2 bool ch_on; // crosshair displayed and covered area saved in under_chx/y bool draw_ch; // crosshair should be displayed (set in update) Pixmap under_chx, under_chy; // to save area covered by cursor virtual void zoom_in(float x1, float y1, float x2, float y2); virtual void zoom_out(float x1, float y1, float x2, float y2); virtual void zoom_reset(void); virtual void zoom_full(void) {} virtual void put_ch(void); // put crosshair on, get coodinates from group virtual bool ch_pos_ok(void); virtual bool crosshair_out(void); virtual void clear_ch(void); // crosshair off, restore area covered virtual void get_ch_xy(void); // inquire about crosshair x/y in group void set_ch_xy(int x, int y); // store crosshair x/y ppm in group void set_ch_ind(void); // store indirect dimensions in group void new_group(bool automatic=false); void change_to_active_group(bool automatic=false); virtual char * iname(int d); virtual void Leave_CB(XCrossingEvent ev); virtual void KeyPress_CB(XKeyEvent ev); virtual void BPress_CB(XButtonEvent ev); virtual void BRelease_CB(XButtonEvent ev); spec_group * group; // own proup virtual void do_group_perm(bool automatic); void change_id(void); cursor_window(window & parent, int w, int h, int x, int y, int bw=1); virtual ~cursor_window(); virtual void define_coord(float x1, float y1, float x2, float y2); void set_standard(void); void clear(void); static spec_group * active_group; // group to which new members are added void set_group_interactive(void); void set_group_perm(int * prm, spec_group * g=NULL); virtual void set_group_automatic(void); virtual void update(); void resize(int w, int h); void redraw(void); // compute window-coordinates from ppm-values int x_window(float x) { return (int)(xf * (x - xl) + .5); } int y_window(float y) { return height - (int)(yf * (y - yd) + .5); } // back transformation : window coords to world-values=ppm float x_org(int xw) { return xw/xf + xl; } float y_org(int yw) { return (height - yw)/yf + yd; } // relative in window coordinates void rwline(int xre, int yre) { line(xc, yc, xc + xre, yc - yre); xc=xc + xre; yc=yc - yre; } void rwmove(int xre, int yre) { xc=xc + xre; yc=yc - yre; } // in ppm void pmove(float xp, float yp) { xc=x_window(xp); yc=y_window(yp); } void pline(float xp, float yp) { line(xc,yc,x_window(xp),y_window(yp)); xc=x_window(xp); yc=y_window(yp); } virtual void center_around_cursor(void); }; class me_residue_list; class spectrum; enum ContourModes { Contour, Detect1, Detect2, Intensity }; class spec_window : public cursor_window { protected: static XColor spec_color[NR_SPEC_COLORS]; // matrix of allocated colors for PseudoColor static unsigned int spec_colorT[NR_SPEC_COLORS]; // matrix for Truecolor cSpec * wspec; // a private 2D spectrum in x/y orientation spec_access * spa; // how to get data from memory int xfsw, yfsw; // max. number of window pixels per spectrum pixel level_list *lvll; // pointer to contour information ContourModes contourmode; public: virtual void center_around_cursor(void); spec_io * spio; // a private spec_io to read from the file static color_popup *xcw; // xeasy-type color window spec_display * sd; // if spec_window is part of a spec_display bool allow_folding; static int perm_wsn[DIMENSION]; protected: static Colormap ini_colors(void); static void allocate_1(void); // color allocation for spectra static void allocate_2(void); int shift, scale; // for float -> char transformation static int d_shift, d_scale; int ccol; // currently gc set to spec_color[ccol] void default_perm_spio(scan_param * scpa); void default_perm_strip(void); void set_perm_new(void); signed char col_from_float(float x); void draw_interior(void) {} //## redraw(); } void zoom_out(float x1, float y1, float x2, float y2); void zoom_in(float x1, float y1, float x2, float y2); void zoom_reset(void); void zoom_full(void); int calc_plane(int d); // return plane resulting from group->ppm_ch void get_plane(void); // load plane and redraw int current_plane(int d); int max_plane(int d); void goto_plane(int pln, int d, bool do_re_read); void goto_plane(float to_ppm, int d, bool do_re_read); void change_plane(void); void switch_to_spio(void); virtual void re_read(void); void define_coord(float x1, float y1, float x2, float y2); void take_colors(void); void put_colors(void); void show_peaks_strip(strip_spec_3D * tool, bool check_strip=false); void show_original(proton_list * o_prot, calfold * full_spec, int dx, int dy); virtual void Motion_CB(XMotionEvent ev); virtual void Enter_CB(XCrossingEvent ev); virtual void BPress_CB(XButtonEvent ev); virtual void KeyPress_CB(XKeyEvent ev); public: spec_window(window & parent, int w, int h, int x, int y, int bw=0); virtual ~spec_window(); char * iname(int d); void redraw(void); void use(spec_io * src_spio, scan_param * scpa=NULL); void use(spec_io * src_spio, int * perm_wsn); void use(nSpec * spec, int * perm_sc); void use(char * spec_name, char * xiname, char * yiname); void show(float * psl, float * psh, float * thick=NULL, bool do_map=true); void show(peak_info2 * p2); bool show_strip(peaklist2 * pl, int nr); bool show_strip(pal_list * pl, int res); bool show_strip(proton_list * prot, int assx, int assp, float wx, float thick=0.5); void show_peaks(pal_list * pl, int * perm_cl=NULL, int disp_mode=0); void clear_peaks(pal_list * pl=NULL); void show_ini(bool do_map=true); void update(); // adapt crosshair &indirect dim friend class strip_spec_3D; friend class ecosy_tool; friend class strip_comparison; friend class strip_residue; friend class level; }; class ls_window : public cursor_window { // dimensions: 0=x, all others=indirect; y=intensity is treated separately public: char x_iname[IDLN]; ls_window(window & parent, int w, int h, int x, int y); ~ls_window(); void ppm_range(float xh, float xl, char * iname=NULL); void show_slice(spec_io * spio, float * ppm_a, int * perm_wa, float half_range, int color, int ori=0); // extract lineshape, add it to to_draw, draw it. command modifies spio! char * iname(int d); void redraw(void); void do_group_perm(bool automatic); virtual void update(void); virtual void Enter_CB(XCrossingEvent ev); virtual void Motion_CB(XMotionEvent ev); virtual void BPress_CB(XButtonEvent ev); virtual void KeyPress_CB(XKeyEvent ev); void zoom_in(float x1, float y1, float x2, float y2); void zoom_out(float x1, float y1, float x2, float y2); }; #define NOAH_ww 200 #define NOAH_wh 180 #define Col_peak 5 #define Col_select 1 #define Col_stnd 2 // no overlap: lime green #define Col_far_ovrlp 1 // cyan #define Col_near_ovrlp 3 // strong overlap: orange #define Col_new_shape 6 // interactively modified position: light green #define MAX_ASS_POS 10 // max. number of possible assignments #define NR_CDISP 3 // max. number of assignment combinations displayed at the same time class tool_ls_window : public ls_window { protected: ls_tool * tool; int pdim; // present dimension in perm of tool tool_ls_window(ls_tool& parent, int w, int h, int x, int y); virtual void KeyPress_CB(XKeyEvent ev); virtual void BPress_CB(XButtonEvent ev); friend class ls_tool; friend class NOAH_tool; friend class check_tool; }; class tool_spec_window : public spec_window { ls_tool * tool; bool connected; public: tool_ls_window * orig_slw; int orig_nr; // cp in orig->to_draw tool_spec_window(window & parent, int w, int h, int x, int y); ~tool_spec_window(); protected: float ppm_p[DIMENSION]; // of peak that was used for construction in perm of tool void KeyPress_CB(XKeyEvent ev); friend class ls_tool; friend class check_tool; friend class NOAH_tool; }; class ls_tool : public main_window { protected: bool lists_modified; int dim; float wwp[DIMENSION]; // half width of window in ppm, perm of tool main_window * mdisp; tool_spec_window * disp; strip_spec_3D * disp3; // spec displays for peaks ls_tool(char * name, int w, int h); public: spec_io * spio; virtual ~ls_tool(); pal_list * pl; void new_shape(tool_spec_window * wn); virtual void show_peak(tool_ls_window * ls); virtual void show_name(int pk_nr)=0; virtual void connect_disp(void)=0; virtual void contin(bool at_current=true); virtual void save_lists(void); friend class tool_ls_window; }; class NOAH_ls_window : public tool_ls_window { int nap; // position in parent->noa->ap int pos; // which row. doesnt change after construction int pl_nr; // =NOAH_tool->pl_nr char comment[40]; NOAH_tool * tool; NOAH_ls_window(NOAH_tool & parent, int posx, int dim); virtual void KeyPress_CB(XKeyEvent ev); virtual void redraw(void); virtual void clear(void); void copy(NOAH_ls_window * old, int new_nap); friend class NOAH_tool; }; class ass_pos // noah assignment possibility {public: int res[DIMENSION]; char atom[DIMENSION][8]; int na[DIMENSION]; bool valid; }; class NOAH_list : public library { int check_format(void); char iname[DIMENSION][IDLN]; public: NOAH_list(char * filename); int nr_valid(void); bool valid; int dim; int peak_nr; int nr_ap; ass_pos ap[MAX_ASS_POS]; bool next_peak(void); // return success friend class NOAH_tool; }; class NOAH_tool : public ls_tool { int pl_nr; // current entry in pl int d_rows; // currently displayed number of rows int off_row; // first valid possibility that is displayed NOAH_list * noa; bool skip_undecidable; // skip peaks silently, where no ref-lineshape can be found bool do_continue; int perm_la[DIMENSION]; // pl from noa int perm_wa[DIMENSION]; // spio w from noa char line1[100]; char line2[100]; NOAH_ls_window * slw[NR_CDISP][DIMENSION]; // slice windows void connect_disp(void); void decide(void); bool decidable(void); void make_slw(int row, int ap_nr, int dim); void make_empty_slw(int row, int ap_nr, int dim, char * info); void more_poss(int updown); void resize_row(int rows); void resize(int w, int h); void redraw(void); public: NOAH_tool(void); ~NOAH_tool(); void initialize(spec_io * spio=NULL, pal_list * pl=NULL, NOAH_list * noa=NULL); void contin(bool at_current); void decide_peak(int peak_nr=0); void decide_next(int skip=0); // skip given number of peaks before displaying void take_ap(int row); void take(int ap_nr, int dim); void reject(int row, int dim); void show_name(int n_pl); virtual void KeyPress_CB(XKeyEvent ev); // save_lists() not needed, save only pl }; #define NR_RES_GR 8 // resonance coordinations within one group // spec_group::status #define DISPLAYED 0x0001 #define RELATIVE 0x0002 // Geometry #define Pos_id 3 #define Pos_ch 15 #define Pos_cppm 30 class spec_group : public list, public main_window { float ppm[NR_RES_GR]; // current pointer value int status; public: float ppm_ch[NR_RES_GR]; char iname[NR_RES_GR][IDLN]; int ch_col[NR_RES_GR]; // color of cursor int d_h, d_used; // help, number of used dims spec_group(void); ~spec_group(); void update(void); void remove(cursor_window * to_remove); void set_ppm(int d, float ppm); void set_ppm_ch(int d, float ppm); int match_dim(char * c_iname); void redraw(void); void toggle(void); void join(char *id1, char *id2, char *newid); void join(void); void set_interactive(void); int change_id(cursor_window*cw, char *id1, char *newid); }; class spec_access { nSpec * spec; // do not delete int perm_sc[DIMENSION]; int off_cs[DIMENSION]; int end_cs[DIMENSION]; bool ok, xy_ok; spec_access(nSpec * specx, int * perm_scx); bool is_ok(float * pal, float * psh); bool is_plane_ok(float ppm, int dim); friend class spec_window; }; class strip_spec_3D : public main_window { int w1, w2, hs; spec_window * s1, * s2, * s3; nSpec * spec; peaklist2 * pls; int pn; pal_list * pll; int * pls_2; sc_peak ** pls_3; int max_idx; float prange[2]; // show area prange ppm around peak bool do_show_original; bool new_spio; // whether lspio has changed proton_list * o_prot; spec_io * lspio; // == spec->spio, delete separately. void show(float * psl, float * psh); void label(void); public: strip_spec_3D(int w1=100, int w2=100, int hs=400); ~strip_spec_3D(); void use(spec_io *spio); void show(peaklist2 * pl, int peak_nr); void redraw(void); void show_peaks(void); void show_original(proton_list * prot); void shift_notify(cursor_window * w, int n); void check_peak_change(void); void kill_notify(cursor_window * w, int n); friend class draw_peak_strip; friend class strip_check; friend class strip_check_chd; friend class spec_window; }; enum draw_obj_type { DRAW_SHAPE, DRAW_PEAK, DRAW_BOX, DRAW_LINE, DRAW_FCPEAK, DRAW_N1DF, DRAW_STRING_AP, DRAW_N1DF_C, DRAW_AREA_LIST }; // DRAW_SHAPE also for shift_shape class draw_obj // abstract base class to draw something into a cursor_window {public: draw_obj_type type; int color; // of drc palette long origin; // to hold a pointer on 64-bit compilers draw_obj(void) { origin=0; color=0; } draw_obj(int col) { origin=0; color=col; } virtual draw_obj * copy(void) = 0; // return a copy of this and copy allocated areas virtual ~draw_obj() {} virtual void draw(cursor_window * cw) = 0; virtual float distance(int xw, int yw, cursor_window * cw) = 0; virtual void shift_notify(cursor_window * w, int x1, int y1, int x2, int y2) {} virtual bool kill_notify(cursor_window * w) { return true; } virtual void query(void) {} }; class draw_list : public list {public: int select_color; int selected; // cp of selected draw_obj or -1 cursor_window * cw; draw_list(cursor_window * cwx); draw_list * copy(void); // return a copy of this and copy allocated areas ~draw_list() {} // dont delete cw! void draw(void); int select(int xw, int yw); // return selected void select(int sel); void deselect(void); void real_shape_ratio(void); void norm_shape(float xh=0, float xl=0); void color_old(draw_obj_type type, int color); }; class draw_peak : public draw_obj { public: static bool allow_shift; pal_list * pl; // origin of peak (origin should contain the index) int perm_ld[PAL_DIM]; // peaklist <-- display x,y,ind int fold[PAL_DIM]; // in dim of display calfold * cf; // only if peak is folded, dim of display, destroy. int di; // type of info displayed draw_peak(pal_list * pl, int nr, int col=0, int di=0, int p_x=0, int p_y=1, int p_i=-1); ~draw_peak() { if(cf) delete cf; cf=NULL; } void draw(cursor_window * cw); float distance(int xw, int yw, cursor_window * cw); void shift_notify(cursor_window * cw, int x1, int y1, int x2, int y2); bool kill_notify(cursor_window * cw); draw_obj * copy(void); void query(void); void assign_interactive(void); void set_fold(int * foldx, calfold * cfx); }; extern void pop_assignment(draw_peak * dpk); class draw_peak_strip : public draw_peak { public: strip_spec_3D * tool; draw_peak_strip(strip_spec_3D * toolx, int nr, int col, int di=0, int px=0, int py=1, int pi=-1); void shift_notify(cursor_window * cw, int x1, int y1, int x2, int y2); bool kill_notify(cursor_window * cw); }; #if RD_DISP class draw_peak_rd : public draw_peak { public: float offset, fr; // 4D peak in 3D reduced dim strip draw_peak_rd(pal_list * pl, int nr, float offset, float fr, int col=0, int di=0, int p_x=0, int p_y=2, int p_i=1, int p_rd=3); void shift_notify(cursor_window * cw, int x1, int y1, int x2, int y2) {} void draw(cursor_window * cw); float distance(int xw, int yw, cursor_window * cw); }; #endif class ppm_point {public: float x, y; ppm_point(void) { x=0; y=0; } }; class draw_shape : public draw_obj, public elist {public: draw_shape(void); draw_shape(nSpec * t_spec); float f_int; // factor to display y float li, hi; // ymin, ymax void draw(cursor_window * cw); float distance(int xw, int yw, cursor_window * cw); float miny(void); float maxy(void); void shift_notify(cursor_window * w, int x1, int y1, int x2, int y2); void norm(float xh=0, float xl=0); // adapt f_int, so that max +/- 1 draw_obj * copy(void); float * data_of(float hi, float lo); }; class shift_draw_shape : public draw_shape { public: float shift; shift_draw_shape(void) : draw_shape() { shift=0; } void draw(cursor_window * cw); }; class draw_box : public draw_obj { public: float phx, plx; float phy, ply; char id[20]; draw_box(void); draw_obj * copy(void); void draw(cursor_window * cw); float distance(int xw, int yw, cursor_window * cw); void shift_notify(cursor_window * w, int x1, int y1, int x2, int y2); }; class draw_line : public draw_obj { public: float x0, y0, x1, y1; draw_line(void); draw_line(float a0, float b0, float a1, float b1, int c=0) { x0=a0; y0=b0; x1=a1; y1=b1; color=c; } draw_obj * copy(void); void draw(cursor_window * cw); float distance(int xw, int yw, cursor_window * cw); void shift_notify(cursor_window * w, int x1, int y1, int x2, int y2); void query(void); }; class draw_line_dx : public draw_line { // a line that can be shifted in y, and tilted. public: draw_line_dx(float a0, float b0, float a1, float b1, int c=0) : draw_line(a0, b0, a1, b1, c) {} float distance(int xw, int yw, cursor_window * cw); void shift_notify(cursor_window * w, int x1, int y1, int x2, int y2); }; class draw_line_nosel : public draw_line { float distance(int xw, int yw, cursor_window * cw) { return draw_line::distance(xw, yw, cw)+100; } }; class check_tool : public ls_tool { int perm_wl[DIMENSION]; // perm between w and pl tool_ls_window * ls; int n_prot; int c_dim; char line1[50]; char line2[50]; void connect_disp(void); void display_resonance(void); public: proton_list * prot; check_tool(void); ~check_tool(); void initialize(spec_io * spio); void initialize_spio(spec_io * spio); void ppm_deviations(void); void next_resonance(void); void previous_resonance(void); void redraw(void); void show_name(int pk_nr); void check_assignments_exist(void); void check_protons_exist(void); void lineshapes(void); void pseudoatoms(void); void contin(bool=true); void save_lists(void); void merge(void); }; class check_ls_window : public tool_ls_window { void KeyPress_CB(XKeyEvent ev); public: check_ls_window(check_tool & parent); }; // ************************** ecosy_tool *** #define Range_default 2.0 // if no borders ar given #define Range_moff 0.005 class ecosy_ls_window : public ls_window { ecosy_tool * tool; public: ecosy_ls_window(ecosy_tool * tool); ~ecosy_ls_window() {} void Motion_CB(XMotionEvent ev); void BRelease_CB(XButtonEvent ev); void BPress_CB(XButtonEvent ev); void KeyPress_CB(XKeyEvent ev); }; class ecosy_spec_window : public spec_window { ecosy_tool * tool; public: ecosy_spec_window(ecosy_tool * tool); ~ecosy_spec_window() {} void KeyPress_CB(XKeyEvent ev); void BRelease_CB(XButtonEvent ev); void zoom_in(float x1, float y1, float x2, float y2); void zoom_out(float x1, float y1, float x2, float y2); }; class ecosy_tool : public ls_tool { int perm_wl[DIMENSION]; // perm between w and pl ecosy_ls_window * ls; ecosy_spec_window * disp; ls_window * qual; int c_dim; // 0=lineshapes in x 1=y int pkn; // peak pumber int s_dim; // the other proton, not c_dim bool opt_p, use_all, use_diag, do_borders; // mode of operation int sign_p; // sign of "other" passive coupling int sign_2; // 1 if box2 has higher ppm, -1 if box2 has higher ppm than box1 float base_shift, base_f; // shift2 and f_int2 before button2move draw_line * border1, *border2; // range of valid couplings shift_draw_shape * shp1, * shp2; // 1 is fix and long, 2 is shifted draw_box * box1, * box2; spec_group * group; coupl_list * coupllist; // list of assigned J-couplings indirect_entry_list * iclist; // list to resolve indirect coupling partner proton_entry * atoms[3]; // x, y, and indirect atom int pg_shift; // perm of shift in group float f_ppm2hz[2]; // ppm*f_ppm2hz[]=Hz in x/y of tool void next_peak(int fwd=1); void accept_peak(void); void edit_assignments(void); void adapt_ls(void); int get_indirect_atom(bool ask=true); void display_atoms(void); void display_fit(void); void display_mode(void); shift_draw_shape * lineshape_total(nSpec * area); shift_draw_shape * lineshape_optimize1(nSpec * area); void set_border(void); // set border to crosshair void redraw(void); void contin(bool at_current); public: bool ev_done; ecosy_tool(void); ~ecosy_tool(void); void initialize(void); void KeyPress_CB(XKeyEvent ev); void shift(float dx, float df); void shift_end(void); void box_notify(void); void make_lineshape(draw_box * box, int ref); void save_lists(void); void connect_disp(void) {} void no_border(void); // remove border, set default range void show_name(int) {} void calc_shift(void); friend class ecosy_spec_window; }; class strip_check_chd : public table_handler { int col_start[2]; // 1 col of commands int c; // command strip_check * tool; char * buffer; public: strip_check_chd(strip_check * t); void handle(int col, int row); void restart(void); }; class strip_check { strip_spec_3D * s3D; proton_list * old_prot; strip_check_chd * chd; main_t_window * tx; peaklist2 * pl; int filter; pal_list * dpl; main_window * sh_mw; cursor_window * sh_cw; spec_group * sh_g; // sweep int sw_dim; draw_line_dx * sweep_line; bool include_overlapping; void strip_seen(void); void reference_shift(void); void edit_prange(void); void select_id(void); void new_strip(void); void new_peak(void); void shift_interactive_1(void); void shift_interactive_2(void); void shift_interactive_info(void); void sweep_interactive_1(void); void sweep_interactive_2(void); void sweep_interactive_info(void); int selected_peak(void); public: strip_check(main_t_window * tx); ~strip_check(); void initialize(void); void next(void); void fold_peaklist(void); void get_filter(void); void recalculate(void); void recalculate_1(peaklist2 * all, int cp); void recalculate_o(peaklist2 * all, int cp); friend class strip_check_chd; friend class filter_selector; friend class shift_interactive_thd; friend class sweep_interactive_thd; }; #if RD_DISP class rd_spec_window : public spec_window { char rd_iname[IDLN]; int rd1_ch, rd2_ch; // chrosshair position in y int pg_rd; Pixmap under_ch_rd1, under_ch_rd2; void put_ch(void); // put crosshair on, get coodinates from group void clear_ch(void); // crosshair off, restore area covered void get_ch_xy(void); // inquire about crosshair x/y in group void set_ch_rd(int y); // store crosshair x/y ppm in group virtual char * iname(int d); virtual void Motion_CB(XMotionEvent ev); virtual void BPress_CB(XButtonEvent ev); void resize(int w, int h); float ppm_rd(int y); bool use_p(int y); virtual void do_group_perm(bool automatic); virtual bool ch_pos_ok(void); public: bool is_rd; float offset, frd; rd_spec_window(window & parent, int w, int h, int x, int y, int bw=0); ~rd_spec_window(); void rd_set(float off, float frd, char * rd_iname); friend class spec_group; }; #endif // RD_DISP #define PDETECT -99 class pal_list_entry { public: pal_list * pl; int color; int disp_mode; int perm_lc[PAL_DIM]; pal_list_entry(pal_list * xpl) { disp_mode=color=0; pl=xpl; for(int i=0;if_name); } ~pal_list_entry() { peaklist_back(pl); } }; class pal_list_list : public list { public: int na; // index of active list (to add peaks) void remove_interactive(void); void ask_active(void); // interactive determination of active peaklist pal_list *active(void); // check & get pp[na]. Do not ask. pal_list_list *operator=(pal_list_list &B); }; enum nevent { Shift, Kill }; enum action_state { Ignore, PickPeak }; class spec_display : public main_window { public: pal_list_list *pll; spec_window *sw; action_state state; spec_display(int w=500, int h=400); ~spec_display(); void make_sw(void); // always call after construction! must be separate to use spec_display as a base class of ass_tool. void notify(nevent e, pal_list *pl, int nr) { switch(e) { case Shift: shift_notify(pl, nr); break; case Kill: kill_notify(pl, nr); break; } } void shift_notify(pal_list *pl, int nr); void kill_notify(pal_list *pl, int nr); void display_peaklist(void); void update_peaks(pal_list * pl=NULL); void KeyPress_CB(XKeyEvent ev); bool handle_button(XButtonEvent ev); // return true if no further action required. void edit(void); void pick_peak(float x, float y); void new_peaklist(void); }; class spec_display_chain : public chained { public: spec_display * sd; spec_display_chain(spec_display * xsd); ~spec_display_chain(); void notify(nevent e, pal_list *pl, int nr) { if(!this) return; if(sd) sd->notify(e, pl, nr); if(next) ((spec_display_chain*)next)->notify(e, pl, nr); } }; extern spec_display_chain * sdcp; // the point to chain all spec_displays class infit; class inf_shp_window; class inf_J_window; class inf_tool : public main_window { // INFIT public: spec_window * w1; inf_shp_window * w2; // lineshapes inf_J_window *w3; // coupling constants protected: int dim; float wwp[DIMENSION]; // half width of window in ppm, perm of tool coupl_list * coupllist; // list of assigned J-couplings pal_list * pl; infit * inf; char at_name[IDLN], at_name2[IDLN], at_name3[IDLN]; int res, res2, res3; int ass, ass2; int pl_np; // current bool show_all; draw_shape * exp_sh, * sim_sh; draw_shape * Jdep; // SSQD float Jlo, Jhi, Jopti; int color; void sum_shapes(void); // add all shapes in w2 to exp_sh public: bool lists_modified; inf_tool(void); ~inf_tool(); void save_lists(void); void new_peak(void); void another_peak(void); void next_peak(void); void get_data(void); void add_shape(void); void KeyPress_CB(XKeyEvent ev); void calculate(void); void write_cc_entry(void); friend class inf_spec_window; friend class inf_J_window; friend class inf_shp_window; }; #endif // _H_SPECDISP_