BALL  1.4.1
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 std::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 editSelectionColor(QColor color);
00222 
00224       void coloringOptionsPressed();
00225 
00227       void modelOptionsPressed();
00228 
00230       void precisionBoxChanged(int index);
00231 
00233       void transparencySliderChanged();
00234 
00236       void precisionSliderChanged();
00237 
00239       void coloringUpdatesChanged();
00240 
00242       void modelUpdatesChanged();
00243 
00245       
00246       
00247       protected:
00248       
00249       //_ Set buttons and slider according to the values
00250       void checkDrawingPrecision_();
00251 
00252       //_
00253       virtual void getAdvancedModelOptions_();
00254 
00255       //_
00256       virtual void getAdvancedColoringOptions_();
00257 
00258       //_
00259       virtual void applyModelSettings_(Representation& rep);
00260       
00261       //_
00262       virtual void applyColoringSettings_(Representation& rep);
00263 
00264       protected:
00265       
00266       void applyTo_(Representation* rep);
00267 
00268       // --------------------------------------------------------------------------------
00269       // attributs
00270       // --------------------------------------------------------------------------------
00271       ModelSettingsDialog*      model_settings_;
00272       ColoringSettingsDialog*   coloring_settings_;
00273       Preferences*              preferences_;
00274       
00275       // the menu entry id of the dialog
00276       QAction*        id_;
00277       QPushButton* create_button_;
00278       
00279       // used by GeometricControl to modify an existing representation
00280       Representation* rep_;
00281 
00282       ColorRGBA       custom_color_;
00283       bool            advanced_options_modified_;
00284       bool            create_representations_for_new_molecules_;
00285       bool            changed_selection_color_;
00286       const ModelInformation* model_information_;
00287     };
00288 
00289 } } // namespaces
00290 
00291 #endif // BALL_VIEW_DIALOGS_DISPLAYPROPERTIES_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines