SampleDisplay.h
上传用户:weiliju62
上传日期:2007-01-06
资源大小:619k
文件大小:5k
- /* cdrdao - write audio CD-Rs in disc-at-once mode
- *
- * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de>
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
- /*
- * $Log: SampleDisplay.h,v $
- * Revision 1.2 1999/01/30 15:11:13 mueller
- * First released version. Compiles with Gtk-- 0.9.14.
- *
- * Revision 1.1 1998/11/20 18:55:22 mueller
- * Initial revision
- *
- */
- #ifndef __SAMPLE_DISPLAY_H
- #define __SAMPLE_DISPLAY_H
- #include <gtk--.h>
- #include <gtk/gtk.h>
- #include "TrackManager.h"
- class Toc;
- class Sample;
- class TocEdit;
- class SampleDisplay : public Gtk_DrawingArea {
- private:
- enum DragMode { DRAG_NONE, DRAG_SAMPLE_MARKER, DRAG_TRACK_MARKER };
- Gtk_Adjustment *adjustment_;
- Gdk_Pixmap *pixmap_;
- Gdk_Pixmap *trackMarkerPixmap_;
- Gdk_Pixmap *indexMarkerPixmap_;
- Gdk_Pixmap *trackMarkerSelectedPixmap_;
- Gdk_Pixmap *indexMarkerSelectedPixmap_;
- Gdk_Pixmap *trackExtendPixmap_;
- Gdk_Pixmap *indexExtendPixmap_;
- Gdk_GC *drawGc_;
- Gdk_Color sampleColor_;
- Gdk_Color middleLineColor_;
- Gdk_Color cursorColor_;
- Gdk_Color markerColor_;
- Gdk_Color selectionBackgroundColor_;
- Gdk_Font *timeTickFont_;
- gint width_;
- gint height_;
- gint timeLineHeight_;
- gint timeLineY_;
- gint timeTickWidth_;
- gint timeTickSep_;
- gint sampleStartX_;
- gint sampleEndX_;
- gint sampleWidthX_;
- gint trackLineHeight_;
- gint trackLineY_;
- gint trackMarkerWidth_;
- Gdk_Font *trackMarkerFont_;
- const TrackManager::Entry *pickedTrackMarker_;
- gint chanSep_;
- gint chanHeight_;
- gint lcenter_;
- gint rcenter_;
- TrackManager *trackManager_;
- TocEdit *tocEdit_;
- unsigned long minSample_;
- unsigned long maxSample_;
- unsigned long resolution_;
- int cursorDrawn_;
- gint cursorX_;
- int cursorControlExtern_;
- int markerSet_;
- gint markerX_;
- unsigned long markerSample_;
- int selectionSet_;
- unsigned long selectionStartSample_;
- unsigned long selectionEndSample_;
- gint selectionStart_;
- gint selectionEnd_;
- int regionSet_;
- unsigned long regionStartSample_;
- unsigned long regionEndSample_;
- int selectedTrack_;
- int selectedIndex_;
- DragMode dragMode_;
- gint dragStart_, dragEnd_;
- gint dragStopMin_, dragStopMax_;
- gint dragLastX_;
- void scrollTo();
- void redraw(gint x, gint y, gint width, gint height, int);
- void readSamples(long startBlock, long endBlock);
- void updateSamples();
- void drawCursor(gint);
- void undrawCursor();
- void getColor(const char *, Gdk_Color *);
- unsigned long pixel2sample(gint x);
- gint sample2pixel(unsigned long);
- void drawMarker();
- void removeMarker();
- void drawTimeTick(gint x, gint y, unsigned long sample);
- gint timeTickWidth();
- void drawTimeLine();
- gint trackMarkerWidth();
- void drawTrackMarker(int mode, gint x, int trackNr, int indexNr,
- int selected, int extend);
- void drawTrackLine();
- public:
- SampleDisplay();
- void setTocEdit(TocEdit *);
- int getSelection(unsigned long *start, unsigned long *end);
- void setSelectedTrackMarker(int trackNr, int indexNr);
- void setMarker(unsigned long sample);
- void clearMarker();
- int getMarker(unsigned long *);
- void setView(unsigned long start, unsigned long end);
- void getView(unsigned long *start, unsigned long *end);
- void setRegion(unsigned long start, unsigned long end);
- int getRegion(unsigned long *start, unsigned long *end);
- Gtk_Adjustment *getAdjustment() { return adjustment_; }
- void updateTrackMarks();
- void setCursor(int, unsigned long);
- void updateToc();
- Signal1<unsigned long> markerSet;
- Signal1<unsigned long> cursorMoved;
- Signal2<unsigned long, unsigned long> selectionSet;
- Signal3<const Track *, int, int> trackMarkSelected;
- Signal4<const Track *, int, int, unsigned long> trackMarkMoved;
-
- protected:
- int handle_configure_event (GdkEventConfigure *);
- int handle_expose_event (GdkEventExpose *event);
- int handle_motion_notify_event (GdkEventMotion *event);
- int handleButtonPressEvent(GdkEventButton*);
- int handleButtonReleaseEvent(GdkEventButton*);
- int handleEnterEvent(GdkEventCrossing*);
- int handleLeaveEvent(GdkEventCrossing*);
- };
- #endif