#ifndef CONTROL_H #define CONTROL_H #include // ANSI stream library #include // File streams #include #include "DSP2D.h" // The 2D signal processing library #include "filter.h" // The (local) filter subthread #include "scrolldisplay.h" // This is a proprietary QT widget class #include "picture_display.h" #include // QT classes #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include class control; class pdisplay; class pdisplay : public picture_display { // This is the only visible part - the picture display Q_OBJECT public: pdisplay(QWidget *parent=0, const char *name=0, WFlags flags=0); // Constructor void startFilter (pdisplay*); // The control object calls this to start the filter with output to pdisplay* void convertFromFP (); // Convert from floating point to discrete image void convertToFP (); // Convert from discrete to floating point image void setMenu (QPopupMenu*, QPopupMenu*, QPopupMenu*, QPopupMenu*); // Send this object the system's popup-menu void setKernel (int, KERNEL2D&); // Send this object the kernels int width (); // Get image width int height (); // Get image height private: filter filter_thread; // The filter process runs as a thread QTimer timer; // Used to update the progress-bar int w,h; // Image width and height DSP2D layer [3]; // Floating point image KERNEL2D *kernel[3]; // Kernels to use pdisplay* output_display; // Use output_display->layer[] for filter output QPopupMenu *cmenu, *rmenu, *gmenu, *bmenu; // The filter menu void closeEvent (QCloseEvent*); // The windows calls this if it wants to close void windowActivationChange(bool); // The window became active or lost activation signals: void displayCloses (pdisplay*); // Tells the control process that a display will close void requestDisplay (pdisplay*); // Tells the control process that a new display for output is needed void selectLayer (int); // Tells the control process that the filter popup opened on layer #int void filterDone (pdisplay*); // Tells the control process that the filter finished void activated (pdisplay*); public slots: void aboutToQuitSlot (); // This informs the control widget that this display closes void loadButtonSlot (); // Load button pressed void saveButtonSlot (); // Save button pressed void filterButtonSlot (); // Filter button pressed void updateProgress (); // Progress bar update void filterDoneSlot (); // The filter thread finished void colourPressedSlot(QMouseEvent*); // Clicked on colour display void redPressedSlot(QMouseEvent*); // Clicked on red display void greenPressedSlot(QMouseEvent*); // Clicked on green display void bluePressedSlot(QMouseEvent*); // Clicked on blue display private slots: void setRed0 (int); void setRed1 (int); void setGreen0(int); void setGreen1(int); void setBlue0 (int); void setBlue1 (int); void autoScR (); void autoScG (); void autoScB (); friend class control; }; class control : public QWidget { // This is the MainWidget - it is not visible, but controls the whole system Q_OBJECT public: control (QWidget *parent=0, const char *name=0, WFlags f=0); // Constructor - this is used as main-widget, but is not visible - it just controls the set of pdisplay's public slots: void aboutToQuitSlot (); // Last things to do before exit void checkinDisplaySlot (pdisplay*); // A pdisplay checks in void checkoutDisplaySlot (pdisplay*); // A pdisplay checks out void selectLayerSlot (int); // Called from pdisplay- tells the control object what color layer was clicked void activateCFilter (int); // A filter was selected from the popup-menu void activateRFilter (int); // A filter was selected from the popup-menu void activateGFilter (int); // A filter was selected from the popup-menu void activateBFilter (int); // A filter was selected from the popup-menu void clearCachesSlot (pdisplay*); void activatedSlot (pdisplay*); private: pdisplay* newDisplay(); void scanDirectory (QString,QPopupMenu*,QPopupMenu*,QPopupMenu*,QPopupMenu*);// This builds the popupmenu and the filter selection tree from the .KERNELS directory set children; pdisplay* working_display; // Direct pointer to the display which currently has an active filter thread QPopupMenu cpopupmenu, rpopupmenu, gpopupmenu, bpopupmenu; KERNEL2D *copy_kernel, *delete_kernel, // This are the only kernels to be defined internally *mult2_kernel, *div2_kernel, *negate_kernel; KERNEL_MANAGER manager; // The kernel manager - used to resolve kernel names and to store the kernels string activeKernel[3]; // The names of the three selected kernels int activeLayer; // The last activated layer pdisplay *activeDisplay; }; #endif