displayProperties.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: displayProperties.h,v 1.43.16.1 2007/03/25 21:25:46 oliver Exp $
00005 //
00006 
00007 #ifndef BALL_VIEW_DIALOGS_DISPLAYPROPERTIES_H
00008 #define BALL_VIEW_DIALOGS_DISPLAYPROPERTIES_H
00009 
00010 #ifndef BALL_COMMON_GLOBAL_H
00011 # include <BALL/COMMON/global.h>
00012 #endif
00013 
00014 #ifndef BALL_VIEW_KERNEL_MODULARWIDGET_H
00015 # include <BALL/VIEW/KERNEL/modularWidget.h>
00016 #endif
00017 
00018 #ifndef BALL_VIEW_DATATYPE_COLORRGBA_H
00019 # include <BALL/VIEW/DATATYPE/colorRGBA.h>
00020 #endif
00021 
00022 #ifndef BALL_VIEW_KERNEL_PREFERENCESENTRY
00023 # include <BALL/VIEW/KERNEL/preferencesEntry.h>
00024 #endif
00025 
00026 #include <BALL/VIEW/UIC/ui_displayProperties.h>
00027 
00028 namespace BALL
00029 {
00030   class Composite;
00031 
00032   namespace VIEW
00033   {
00034     class Representation;
00035     
00036     class ColoringSettingsDialog;
00037     class ModelSettingsDialog;
00038     class Preferences;
00039     class ModelInformation;
00040 
00054     class BALL_VIEW_EXPORT DisplayProperties 
00055       : public QDialog,
00056         public Ui_DisplayPropertiesData,
00057         public ModularWidget,
00058         public PreferencesEntry
00059     {
00060       Q_OBJECT
00061         
00062       public:
00063       
00064       BALL_EMBEDDABLE(DisplayProperties,ModularWidget)
00065 
00066       
00069 
00073       DisplayProperties(QWidget *parent = NULL, const char* name = "DisplayProperties");
00074 
00076       DisplayProperties(const DisplayProperties& dp);
00077 
00080       virtual ~DisplayProperties();
00081 
00083 
00086 
00098       virtual void onNotify(Message *message);
00099       
00101 
00104       
00111       virtual void initializeWidget(MainControl& main_control);
00112         
00114       virtual void initializePreferencesTab(Preferences &preferences);
00115 
00117       virtual void finalizePreferencesTab(Preferences &preferences);
00118 
00120       void applyPreferences();
00121 
00127       virtual void checkMenu(MainControl& main_control);
00128 
00130       void createRepresentationMode();
00131 
00133       void modifyRepresentationMode(Representation* rep);
00134   
00136       bool getSettingsFromString(const String& data);
00137 
00139       void createRepresentation(String data_string, const vector<const Composite*>& new_systems);
00140 
00142       void enableCreationForNewMolecules(bool state) 
00143         { create_representations_for_new_molecules_ = state;}
00144 
00146       Representation* getRepresentation() 
00147         { return rep_;}
00148 
00149       /*  Create the new representation for the selection in the MolecularControl or for a given List of Composites.
00150           Called by onNotify() after receiving CompositeMessage::NEW_MOLECULE and by apply().
00151           To insert a new type of model, this is the only method in DisplayProperties you have to
00152           change (See also VIEW/KERNEL/common.h).
00153           @param hidden set to true will prevent that the representations model is created right now
00154       */
00155       virtual Representation* createRepresentation(const List<Composite*>& composites, bool hidden = false);
00156 
00157 
00159       void setModelSettingsDialog(ModelSettingsDialog* dialog);
00160   
00162       void setColoringSettingsDialog(ColoringSettingsDialog* dialog);
00163   
00164       public slots:
00165           
00167 
00170 
00174       void show();
00175 
00176       
00182       void selectModel(int index);
00183 
00189       void selectMode(int index);
00190 
00196       void selectColoringMethod(int index);
00197 
00199       void setSurfaceDrawingPrecision(float value);
00200       
00202       void setDrawingPrecision(int value);
00203 
00205       void setTransparency(int value);
00206 
00208       void setCustomColor(const ColorRGBA& color);
00209       
00216       virtual void apply();
00217       
00221       void editColor();
00222 
00226       void editSelectionColor();
00227 
00229       void coloringOptionsPressed();
00230 
00232       void modelOptionsPressed();
00233 
00235       void precisionBoxChanged(int index);
00236 
00238       void transparencySliderChanged();
00239 
00241       void precisionSliderChanged();
00242 
00244       void coloringUpdatesChanged();
00245 
00247       void modelUpdatesChanged();
00248 
00250       
00251       
00252       protected:
00253       
00254       //_ Set buttons and slider according to the values
00255       void checkDrawingPrecision_();
00256 
00257       //_
00258       virtual void getAdvancedModelOptions_();
00259 
00260       //_
00261       virtual void getAdvancedColoringOptions_();
00262 
00263       //_
00264       virtual void applyModelSettings_(Representation& rep);
00265       
00266       //_
00267       virtual void applyColoringSettings_(Representation& rep);
00268 
00269       protected:
00270       
00271       void applyTo_(Representation* rep);
00272 
00273       // --------------------------------------------------------------------------------
00274       // attributs
00275       // --------------------------------------------------------------------------------
00276       ModelSettingsDialog*      model_settings_;
00277       ColoringSettingsDialog*   coloring_settings_;
00278       Preferences*              preferences_;
00279       
00280       // the menu entry id of the dialog
00281       QAction*        id_;
00282       
00283       // used by GeometricControl to modify an existing representation
00284       Representation* rep_;
00285 
00286       ColorRGBA       custom_color_;
00287       bool            advanced_options_modified_;
00288       bool            create_representations_for_new_molecules_;
00289       bool            changed_selection_color_;
00290       const ModelInformation* model_information_;
00291     };
00292 
00293 } } // namespaces
00294 
00295 #endif // BALL_VIEW_DIALOGS_DISPLAYPROPERTIES_H