From 5d6cd9d4023ed05638e51865e1acc1c94d6b8e5c Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 4 Jun 2008 15:31:46 +0000 Subject: [PATCH] Improvement of the Slider & Sweep panels management. Now it will be possible to change their visibilities through corresponding tool bars --- resources/Makefile.am | 2 + resources/Visu_slider_panel.png | Bin 0 -> 1056 bytes resources/Visu_sweep_panel.png | Bin 0 -> 835 bytes src/VISUGUI/Makefile.am | 2 - src/VISUGUI/VISU_images.ts | 2 + src/VISUGUI/VISU_msg_en.ts | 35 ++--- src/VISUGUI/VisuGUI.cxx | 208 +++++++++++++++--------------- src/VISUGUI/VisuGUI.h | 6 +- src/VISUGUI/VisuGUI_ActionsDef.h | 5 +- src/VISUGUI/VisuGUI_CacheDlg.cxx | 213 ------------------------------- src/VISUGUI/VisuGUI_CacheDlg.h | 71 ----------- src/VISUGUI/VisuGUI_Slider.cxx | 85 +++++++++--- src/VISUGUI/VisuGUI_Slider.h | 9 ++ src/VISUGUI/VisuGUI_Sweep.cxx | 44 +++++-- src/VISUGUI/VisuGUI_Sweep.h | 9 ++ 15 files changed, 247 insertions(+), 444 deletions(-) create mode 100644 resources/Visu_slider_panel.png create mode 100644 resources/Visu_sweep_panel.png delete mode 100644 src/VISUGUI/VisuGUI_CacheDlg.cxx delete mode 100644 src/VISUGUI/VisuGUI_CacheDlg.h diff --git a/resources/Makefile.am b/resources/Makefile.am index a3c7f490..6f4c1ddd 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -72,6 +72,8 @@ Visu_scalars.png \ Visu_scaling.png \ Visu_selectall.png \ Visu_selection_panel.png \ +Visu_slider_panel.png \ +Visu_sweep_panel.png \ Visu_selectionactor.png \ Visu_selectioncell.png \ Visu_selectionedge.png \ diff --git a/resources/Visu_slider_panel.png b/resources/Visu_slider_panel.png new file mode 100644 index 0000000000000000000000000000000000000000..8129a9e2c112420e3068a9ccc57c2a09b0e7a880 GIT binary patch literal 1056 zcmV+*1mF9KP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZSu%+k%Z|_-(?-AaU!~0U$>O zhU8^%77V6l4Z03;+QHGY}M8A^&iLrVA$HTFaQJ)ES6tD10Mt=fNC86`~+$QD*R;(F>y+hB*Xt-K$rXh ziUVlmV8TPznct00MjY zAJAo=fd+jBYWfDmzknF(EeV(_et-z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;xk*GpRCwBA`2YVu11^x3{QQ5A{}bE_umFGnV!|bn z6#wl1hYx=l-o5?Hps9KXWGELg1_A^SP6OY(`OEP9`5%UtFMl)q`TGVWq)CjS00G2+ z$IJ2>D!2ZtDjo+Zm;=NaATdJb0R#{WKFJ$*)G~pT2`OO+5I}Gjww^fjzx>c{Waoms zXM9yg1|*j8LO}r|9Nz{8g4Ms&)P(B;2p~p~fmMh1{{QypH^aLh-x)Ig%O{2>Z(cLJ zee{^&)8nVe5%BGitn4*LE-nT}Zjc>d@53}R{C)nM;r*8{3`Zm-Uqi!}3m|~NE@Wh6 zly~iIfAHhuM~1^q9dm&aXMlJ+5I+QB5vV~R{O!Xx@819aKQah%A7O-A>AB?n?vuv|8Ife{)XYf3z`245>K>%;;)fi4G=&u13`kPku;x%iZMXL z>pIA_|NcGc{r>$Y!|T_78NPf0$Ac);WiWN$00Ia(9dbd#K^{*6mOpV`^8fa|;yBYL zKmftQ5T`$1+t~d7_x3Hr$IqV`)Sf(1fQA`3Xm&|RB(nnbG6UIm&!2-00SF)_Lg`fW z$Pw;$K*OH={R{KOHCP0E2Ri24zkeXZv|v612q2WK_c1E!{|8S`l)QLOS{lUnSRp0` zqGO>k3l5ru$fWikK& N002ovPDHLkV1n=jYw!R7 literal 0 HcmV?d00001 diff --git a/src/VISUGUI/Makefile.am b/src/VISUGUI/Makefile.am index e0544ae6..6fd19625 100644 --- a/src/VISUGUI/Makefile.am +++ b/src/VISUGUI/Makefile.am @@ -74,7 +74,6 @@ dist_libVISU_la_SOURCES= \ VisuGUI_Slider.cxx \ VisuGUI_Sweep.cxx \ VisuGUI_InputPane.cxx \ - VisuGUI_CacheDlg.cxx \ VisuGUI_FieldFilter.cxx \ VisuGUI_ViewExtender.cxx \ VisuGUI_ClippingPlaneMgr.cxx \ @@ -112,7 +111,6 @@ MOC_FILES= \ VisuGUI_Slider_moc.cxx \ VisuGUI_Sweep_moc.cxx \ VisuGUI_InputPane_moc.cxx \ - VisuGUI_CacheDlg_moc.cxx \ VisuGUI_ViewExtender_moc.cxx \ VisuGUI_ClippingPlaneMgr_moc.cxx \ VisuGUI_SegmentationMgr_moc.cxx diff --git a/src/VISUGUI/VISU_images.ts b/src/VISUGUI/VISU_images.ts index cbae951c..7157c48c 100644 --- a/src/VISUGUI/VISU_images.ts +++ b/src/VISUGUI/VISU_images.ts @@ -142,6 +142,8 @@ ICON_SELECTION_PANEL Visu_selection_panel.png + ICON_SLIDER_PANELVisu_slider_panel.png + ICON_SWEEP_PANELVisu_sweep_panel.png ICON_SLIDER_AVI Visu_slider_avi.png diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index 580e1a2e..dc9c0784 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -96,10 +96,8 @@ number of time stamps or number of components is not the same! UNITS_LBL Units - - VISU_3DCACHE_PROPS - 3D Cache properties - + VISU_3DCACHE_PREFERENCES3D Cache + VISU_ANIMATION_PREFERENCESAnimation VISU_COLORS_AND_LABELS Colors && Labels @@ -873,8 +871,8 @@ Please, refer to the documentation. Arrange Actors - MEN_CACHE_PROPERTIES - Properties + MEN_MANAGE_CACHE + Manage MEN_CELL_COLOR @@ -1196,21 +1194,11 @@ Please, refer to the documentation. MEN_WIREFRAME Wireframe - - TOOL_IMPORT - Import Toolbar - - - TOOL_REPRESENTATION - Representation Toolbar - - - TOOL_SELECTION - Selection Toolbar - - - TOOL_VISUALISATION - Visualization Toolbar + TOOL_IMPORTImport + TOOL_REPRESENTATIONRepresentation + TOOL_SELECTIONSelection + TOOL_NAVIGATIONNavigation + TOOL_VISUALISATIONVisualization USE_BUILD_PROGRESS @@ -2190,7 +2178,7 @@ Please, provide non-empty resulting presentation. TOOL_VISUALISATION - Visualization Toolbar + Visualization TOT_DESK_FILE_SAVE_GUI_STATE @@ -2861,6 +2849,7 @@ Please, provide non-empty resulting presentation. VisuGUI_Sweep TITLESweep + MEN_SWEEP_PANESweep NAVIGATION_TABNavigation START_SWEEP_POSITION0 % @@ -2886,6 +2875,7 @@ Please, provide non-empty resulting presentation. VisuGUI_Slider TITLESlider + MEN_SLIDER_PANESlider NAVIGATION_TABNavigation IS_CYCLEDCycled @@ -2899,7 +2889,6 @@ Please, provide non-empty resulting presentation. AVAILABLE_MEMORYFree: SPEEDSpeed - VisuGUI_StreamLinesDlg diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index a7b7c0fe..b101ecff 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -112,7 +112,6 @@ #include "VisuGUI_Displayer.h" #include "VisuGUI_BuildProgressDlg.h" #include "VisuGUI_TransparencyDlg.h" -#include "VisuGUI_CacheDlg.h" #include "VisuGUI_InputPanel.h" #include "VISU_ScalarMap_i.hh" @@ -175,10 +174,11 @@ static int MYDEBUG = 0; VisuGUI ::VisuGUI(): SalomeApp_Module( "VISU" ), - mySlider( NULL ), myDisplayer( 0 ), myInputPanel( 0 ), - mySelectionPanel( 0 ) + mySelectionPanel( 0 ), + mySlider( NULL ), + mySweep( NULL ) { } @@ -1642,7 +1642,7 @@ void VisuGUI ::OnSweep() { - new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() ); + mySweep->show(); } //---------------------------------------------------------------------------- @@ -1993,6 +1993,10 @@ VisuGUI { SalomeApp_Module::initialize( theApp ); + mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() ); + + mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() ); + createActions(); createMenus(); createToolBars(); @@ -2344,6 +2348,10 @@ VisuGUI tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true, this, SLOT(OnSwitchSelectionMode())); + // Defenition of the actions for the "Navigation" tool bar + registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() ); + registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() ); + createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(), tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false, this, SLOT(OnShowAnimation())); @@ -2353,9 +2361,9 @@ VisuGUI tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false, this, SLOT(OnPlot3dFromCutPlane())); - createAction( VISU_CACHE_PROPERTIES, tr("MEN_CACHE_PROPERTIES"), QIcon(), - tr("MEN_CACHE_PROPERTIES"), "", 0, aParent, false, - this, SLOT(OnCacheProperties())); + createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(), + tr("MEN_MANAGE_CACHE"), "", 0, aParent, false, + this, SLOT( OnManageCache() ) ); aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL")); createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap), @@ -2449,6 +2457,11 @@ VisuGUI createTool( VISU_CELL_SELECTION, aToolId ); createTool( VISU_POINT_SELECTION, aToolId ); createTool( VISU_GAUSS_POINT_SELECTION, aToolId ); + + aToolId = createTool( tr( "TOOL_NAVIGATION" ) ); + createTool( VISU_SLIDER_PANEL, aToolId ); + createTool( separator(), aToolId ); + createTool( VISU_SWEEP_PANEL, aToolId ); } void @@ -2864,7 +2877,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QStrin if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){ if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE) - theMenu->addAction( action( VISU_CACHE_PROPERTIES ) ); + theMenu->addAction( action( VISU_MANAGE_CACHE ) ); } theMenu->addSeparator(); @@ -2967,10 +2980,6 @@ VisuGUI { bool aResult = SalomeApp_Module::activateModule( theStudy ); - if ( !mySlider ) { - mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() ); - } - studyActivated(); setMenuShown( true ); setToolShown( true ); @@ -3276,58 +3285,88 @@ void VisuGUI::createPreferences() addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" ); addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" ); - // TAB: "Sweep, Animation" - int srangeTab = addPreference( tr( "Sweep, Animation" ) ); - - // group: "Sweeping preferences" - int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab ); - setPreferenceProperty( sweepGr, "columns", 2 ); - - int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGr, LightApp_Preferences::Selector, "VISU", "sweeping_modes" ); - QStringList sweep_modes; - sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) ); - sweep_modes.append( tr( "VISU_COS_SWEEP" ) ); - sweep_modes.append( tr( "VISU_SIN_SWEEP" ) ); - indices.clear(); - indices.append( 0 ); - indices.append( 1 ); - indices.append( 2 ); - setPreferenceProperty( modeSw, "strings", sweep_modes ); - setPreferenceProperty( modeSw, "indexes", indices ); - - int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGr, - LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" ); - int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGr, - LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" ); - int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGr, - LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" ); - int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGr, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" ); - QStringList ranges; - ranges.append( tr( "PERIOD_PI" ) ); - ranges.append( tr( "PERIOD_2PI" ) ); - indices.clear(); - indices.append( 0 ); - indices.append( 1 ); - setPreferenceProperty( rangeSw, "strings", ranges ); - setPreferenceProperty( rangeSw, "indexes", indices ); - - setPreferenceProperty( timestep, "min", 0.1 ); - setPreferenceProperty( timestep, "step", 0.1 ); - setPreferenceProperty( timestep, "max", 1000 ); - setPreferenceProperty( nbcycles, "max", 100 ); - setPreferenceProperty( nbsteps, "max", 200 ); - - // group: "Animation preferences" - int animationGr = addPreference( tr( "Animation preferences" ), srangeTab ); - setPreferenceProperty( animationGr, "columns", 3 ); + // TAB: "Sweep, Animation, 3D Cache" + int animationTab = addPreference( tr( "Animation" ) ); + { + // group: "3D Cache System prefereces" + { + int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab ); + setPreferenceProperty( cacheGroup, "columns", 2 ); + + int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup, + LightApp_Preferences::Selector, "VISU", "cache_memory_mode" ); + + modes.clear(); + modes.append( tr( "VISU_MINIMAL" ) ); + modes.append( tr( "VISU_LIMITED" ) ); + setPreferenceProperty( memory_mode, "strings", modes ); + + indices.clear(); + indices.append( 0 ); + indices.append( 1 ); + setPreferenceProperty( memory_mode, "indexes", indices ); + + int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup, + LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" ); + setPreferenceProperty( memory_limit, "min", 1 ); + setPreferenceProperty( memory_limit, "max", 5000 ); + setPreferenceProperty( memory_limit, "step", 10 ); + } - int speed = addPreference( tr( "Speed" ), animationGr, LightApp_Preferences::IntSpin, "VISU", "speed" ); - addPreference( tr( "Cycled animation" ), animationGr, LightApp_Preferences::Bool, "VISU", "cycled_animation" ); - addPreference( tr( "Use proportional timing" ), animationGr, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" ); - addPreference( tr( "Clean memory at each frame" ), animationGr, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" ); + // group: "Animation preferences" + { + int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab ); + setPreferenceProperty( animationGroup, "columns", 3 ); + + int speed = addPreference( tr( "Speed" ), animationGroup, LightApp_Preferences::IntSpin, "VISU", "speed" ); + addPreference( tr( "Cycled animation" ), animationGroup, LightApp_Preferences::Bool, "VISU", "cycled_animation" ); + addPreference( tr( "Use proportional timing" ), animationGroup, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" ); + addPreference( tr( "Clean memory at each frame" ), animationGroup, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" ); + + setPreferenceProperty( speed, "min", 1 ); + setPreferenceProperty( speed, "max", 99 ); + } - setPreferenceProperty( speed, "min", 1 ); - setPreferenceProperty( speed, "max", 99 ); + // group: "Sweeping preferences" + { + int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab ); + setPreferenceProperty( sweepGroup, "columns", 2 ); + + int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_modes" ); + QStringList sweep_modes; + sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) ); + sweep_modes.append( tr( "VISU_COS_SWEEP" ) ); + sweep_modes.append( tr( "VISU_SIN_SWEEP" ) ); + indices.clear(); + indices.append( 0 ); + indices.append( 1 ); + indices.append( 2 ); + setPreferenceProperty( modeSw, "strings", sweep_modes ); + setPreferenceProperty( modeSw, "indexes", indices ); + + int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup, + LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" ); + int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup, + LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" ); + int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup, + LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" ); + int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" ); + QStringList ranges; + ranges.append( tr( "PERIOD_PI" ) ); + ranges.append( tr( "PERIOD_2PI" ) ); + indices.clear(); + indices.append( 0 ); + indices.append( 1 ); + setPreferenceProperty( rangeSw, "strings", ranges ); + setPreferenceProperty( rangeSw, "indexes", indices ); + + setPreferenceProperty( timestep, "min", 0.1 ); + setPreferenceProperty( timestep, "step", 0.1 ); + setPreferenceProperty( timestep, "max", 1000 ); + setPreferenceProperty( nbcycles, "max", 100 ); + setPreferenceProperty( nbsteps, "max", 200 ); + } + } // TAB: Representation ; group: "Representation properties" int representationTab = addPreference( tr( "Representation" ) ); @@ -3420,31 +3459,6 @@ void VisuGUI::createPreferences() addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" ); - - // TAB: 3D Cache ; group: "Cache properties" - int cacheTab = addPreference( tr( "3D Cache" ) ); - - int cacheGr = addPreference( tr( "VISU_3DCACHE_PROPS" ), cacheTab ); - setPreferenceProperty( cacheGr, "columns", 2 ); - - int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGr, - LightApp_Preferences::Selector, "VISU", "cache_memory_mode" ); - - modes.clear(); - modes.append( tr( "VISU_MINIMAL" ) ); - modes.append( tr( "VISU_LIMITED" ) ); - setPreferenceProperty( memory_mode, "strings", modes ); - - indices.clear(); - indices.append( 0 ); - indices.append( 1 ); - setPreferenceProperty( memory_mode, "indexes", indices ); - - int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGr, - LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" ); - setPreferenceProperty( memory_limit, "min", 1 ); - setPreferenceProperty( memory_limit, "max", 5000 ); - setPreferenceProperty( memory_limit, "step", 10 ); } void VisuGUI::preferencesChanged( const QString& a, const QString& b) @@ -3644,25 +3658,9 @@ void VisuGUI::OnPlot3dFromCutPlane() } } -void VisuGUI::OnCacheProperties() +void VisuGUI::OnManageCache() { - VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); - if(aSelectionInfo.empty()) - return; - - VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); - _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject; - - CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject); - if( CORBA::is_nil( anObject ) ) - return; - - VISU::ColoredPrs3dCache_var aCache = VISU::GetInterface(anObject); - if( CORBA::is_nil( aCache ) ) - return; - - VisuGUI_CacheDlg* aDlg = new VisuGUI_CacheDlg( aCache, this ); - aDlg->exec(); + mySlider->show(); } diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 92ba9595..fbe7ef55 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -41,9 +41,10 @@ class SUIT_ViewManager; class SVTK_ViewWindow; -class VisuGUI_Slider; class VisuGUI_InputPanel; class VisuGUI_SelectionPanel; +class VisuGUI_Slider; +class VisuGUI_Sweep; namespace VISU { @@ -180,7 +181,7 @@ protected slots: void OnArrangeActors(); void OnPlot3dFromCutPlane(); - void OnCacheProperties(); + void OnManageCache(); // MULTIPR void OnMultiprViewFullRes(); @@ -207,6 +208,7 @@ private: VisuGUI_InputPanel* myInputPanel; VisuGUI_SelectionPanel* mySelectionPanel; VisuGUI_Slider* mySlider; + VisuGUI_Sweep* mySweep; LightApp_Displayer* myDisplayer; VISU::TViewToPrs3d myScalarBarsMap; diff --git a/src/VISUGUI/VisuGUI_ActionsDef.h b/src/VISUGUI/VisuGUI_ActionsDef.h index 7ea0936e..22633b45 100644 --- a/src/VISUGUI/VisuGUI_ActionsDef.h +++ b/src/VISUGUI/VisuGUI_ActionsDef.h @@ -116,7 +116,7 @@ #define VISU_PLOT3D_FROM_CUTPLANE 4085 -#define VISU_CACHE_PROPERTIES 4090 +#define VISU_MANAGE_CACHE 4090 // MULTIPR #define VISU_MULTIPR_FULL_RES 4095 @@ -130,4 +130,7 @@ #define VISU_POINT_SELECTION 4103 #define VISU_GAUSS_POINT_SELECTION 4104 +#define VISU_SLIDER_PANEL 4200 +#define VISU_SWEEP_PANEL 4300 + #endif diff --git a/src/VISUGUI/VisuGUI_CacheDlg.cxx b/src/VISUGUI/VisuGUI_CacheDlg.cxx deleted file mode 100644 index 638d94a8..00000000 --- a/src/VISUGUI/VisuGUI_CacheDlg.cxx +++ /dev/null @@ -1,213 +0,0 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : VisuGUI_CacheDlg.cxx -// Author : Oleg UVAROV -// Module : VISU - -#include "VisuGUI_CacheDlg.h" - -#include "VisuGUI_Tools.h" - -#include "VISU_PipeLine.hxx" - -#include "SUIT_Desktop.h" -#include "SUIT_MessageBox.h" -#include "SUIT_Session.h" -#include "SUIT_ResourceMgr.h" - -#include "SalomeApp_Module.h" - -#include "LightApp_Application.h" - -#include "QtxDoubleSpinBox.h" - -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -VisuGUI_CacheDlg::VisuGUI_CacheDlg( VISU::ColoredPrs3dCache_var theCache, - SalomeApp_Module* theModule ) - : QDialog( VISU::GetDesktop( theModule ), Qt::WindowTitleHint | Qt::WindowSystemMenuHint ), - myCache( theCache ) -{ - setModal( true ); - setWindowTitle( tr( "CACHE_TITLE" ) ); - setAttribute( Qt::WA_DeleteOnClose ); - - QVBoxLayout* aTopLayout = new QVBoxLayout( this ); - aTopLayout->setSpacing( 6 ); - aTopLayout->setMargin( 6 ); - //aTopLayout->setAutoAdd( true ); - - long aMb = 1024 * 1024; - bool isLimitedMemory = myCache->GetMemoryMode() == VISU::ColoredPrs3dCache::LIMITED; - double aLimitedMemory = myCache->GetLimitedMemory(); - double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb; - double anUsedMemory = myCache->GetMemorySize(); - double aLimitedMemoryMax = -#ifdef WNT - max -#else - std::max -#endif - (anUsedMemory + aFreeMemory, aLimitedMemory); - - // Settings - QButtonGroup* aMemoryGroup = new QButtonGroup( this ); - QGroupBox* aGB = new QGroupBox( tr( "MEMORY_MODE" ), this ); - aTopLayout->addWidget( aGB ); - QGridLayout* aGridLay = new QGridLayout( aGB ); - //aMemoryGroup->setRadioButtonExclusive( true ); - - myLimitedMemoryButton = new QRadioButton( tr( "LIMITED_MEMORY" ), aGB ); - myLimitedMemoryButton->setChecked( isLimitedMemory ); - aGridLay->addWidget( myLimitedMemoryButton, 0, 0 ); - - myMimimalMemoryButton = new QRadioButton( tr( "MINIMAL_MEMORY" ), aGB ); - myMimimalMemoryButton->setChecked( !isLimitedMemory ); - aGridLay->addWidget( myMimimalMemoryButton, 1, 0 ); - - myLimitedMemory = new QtxDoubleSpinBox( 1.0, aLimitedMemoryMax, 10.0, aGB ); - myLimitedMemory->setSuffix( " Mb" ); - myLimitedMemory->setValue( aLimitedMemory ); - myLimitedMemory->setEnabled( isLimitedMemory ); - aGridLay->addWidget( myLimitedMemory, 0, 1 ); - - - connect( myLimitedMemoryButton, SIGNAL( toggled( bool ) ), myLimitedMemory, SLOT( setEnabled( bool ) ) ); - - // Current state - QGroupBox* aStateGroup = new QGroupBox( tr( "MEMORY STATE" ), this ); - aTopLayout->addWidget( aStateGroup ); - //aStateGroup->setColumnLayout( 0, Qt::Vertical ); - //aStateGroup->layout()->setSpacing( 0 ); - //aStateGroup->layout()->setMargin( 0 ); - - QGridLayout* aStateLayout = new QGridLayout( aStateGroup ); - aStateLayout->setSpacing(6); - aStateLayout->setMargin(6); - - QLabel* aUsedMemoryLabel = new QLabel( tr( "USED_BY_CACHE" ), aStateGroup ); - myUsedMemory = new QLineEdit( aStateGroup ); - myUsedMemory->setText( QString::number( anUsedMemory ) + " Mb" ); - myUsedMemory->setReadOnly( true ); - myUsedMemory->setEnabled( false ); - QPalette aPal = myUsedMemory->palette(); - aPal.setColor( myUsedMemory->foregroundRole(), Qt::black ); - myUsedMemory->setPalette( aPal ); - //myUsedMemory->setPaletteForegroundColor( Qt::black ); - - QLabel* aFreeMemoryLabel = new QLabel( tr( "FREE" ), aStateGroup ); - myFreeMemory = new QLineEdit( aStateGroup ); - myFreeMemory->setText( QString::number( aFreeMemory ) + " Mb" ); - myFreeMemory->setReadOnly( true ); - myFreeMemory->setEnabled( false ); - aPal = myFreeMemory->palette(); - aPal.setColor( myFreeMemory->foregroundRole(), Qt::black ); - myFreeMemory->setPalette( aPal ); - //myFreeMemory->setPaletteForegroundColor( Qt::black ); - - aStateLayout->addWidget( aUsedMemoryLabel, 0, 0 ); - aStateLayout->addWidget( myUsedMemory, 0, 1 ); - aStateLayout->addWidget( aFreeMemoryLabel, 1, 0 ); - aStateLayout->addWidget( myFreeMemory, 1, 1 ); - - // Ok / Cancel - QGroupBox* GroupButtons = new QGroupBox( this ); - aTopLayout->addWidget( GroupButtons ); - //GroupButtons->setColumnLayout(0, Qt::Vertical ); - //GroupButtons->layout()->setSpacing( 0 ); - //GroupButtons->layout()->setMargin( 0 ); - QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - - QPushButton* buttonOk = new QPushButton( tr( "BUT_OK" ), GroupButtons ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); - - QPushButton* buttonCancel = new QPushButton( tr( "BUT_CANCEL" ) , GroupButtons ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); - - QPushButton* buttonHelp = new QPushButton( tr( "BUT_HELP" ) , GroupButtons ); - buttonHelp->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonHelp, 0, 3 ); - - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); - connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); -} - -VisuGUI_CacheDlg::~VisuGUI_CacheDlg() -{ -} - -bool VisuGUI_CacheDlg::isLimitedMemory() -{ - return myLimitedMemoryButton->isChecked(); -} - -double VisuGUI_CacheDlg::getLimitedMemory() -{ - return myLimitedMemory->value(); -} - -void VisuGUI_CacheDlg::accept() -{ - if( isLimitedMemory() ) - { - myCache->SetMemoryMode( VISU::ColoredPrs3dCache::LIMITED ); - myCache->SetLimitedMemory( (float)getLimitedMemory() ); - } - else - myCache->SetMemoryMode( VISU::ColoredPrs3dCache::MINIMAL ); - - - QDialog::accept(); -} - -void VisuGUI_CacheDlg::onHelp() -{ - QString aHelpFileName;// = "types_of_gauss_points_presentations_page.html"; - LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) - app->onHelpContextModule(app->activeModule() ? - app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName); - else { - SUIT_MessageBox::warning(0, tr("WRN_WARNING"), - tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), - tr("BUT_OK")); - } -} diff --git a/src/VISUGUI/VisuGUI_CacheDlg.h b/src/VISUGUI/VisuGUI_CacheDlg.h deleted file mode 100644 index 59fc1d84..00000000 --- a/src/VISUGUI/VisuGUI_CacheDlg.h +++ /dev/null @@ -1,71 +0,0 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : VisuGUI_CacheDlg.h -// Author : Oleg UVAROV -// Module : VISU - -#ifndef VISUGUI_CACHEDLG_H -#define VISUGUI_CACHEDLG_H - -#include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(VISU_Gen) - -#include - -class QLineEdit; -class QRadioButton; -class QtxDoubleSpinBox; - -class SalomeApp_Module; - -class VisuGUI_CacheDlg : public QDialog -{ - Q_OBJECT - -public: - VisuGUI_CacheDlg( VISU::ColoredPrs3dCache_var aCache, - SalomeApp_Module* theModule ); - virtual ~VisuGUI_CacheDlg(); - -public: - bool isLimitedMemory(); - double getLimitedMemory(); - -protected slots: - virtual void accept(); - - void onHelp(); - -private: - VISU::ColoredPrs3dCache_var myCache; - - QRadioButton* myMimimalMemoryButton; - QRadioButton* myLimitedMemoryButton; - QtxDoubleSpinBox* myLimitedMemory; - - QLineEdit* myUsedMemory; - QLineEdit* myFreeMemory; -}; - -#endif diff --git a/src/VISUGUI/VisuGUI_Slider.cxx b/src/VISUGUI/VisuGUI_Slider.cxx index 0abea289..c03e6694 100644 --- a/src/VISUGUI/VisuGUI_Slider.cxx +++ b/src/VISUGUI/VisuGUI_Slider.cxx @@ -69,6 +69,7 @@ #include #include #include +#include /*! Constructor @@ -89,6 +90,8 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI* theModule, QVBoxLayout* aVBoxLayout = new QVBoxLayout( this ); QTabWidget* aTabWidget = new QTabWidget( this ); + aTabWidget->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ); + aVBoxLayout->addWidget( aTabWidget ); { @@ -158,10 +161,6 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI* theModule, myTimeStampStrings->setFocusPolicy( Qt::StrongFocus ); aGridLayout->addWidget( myTimeStampStrings, 2, 3, 1, 2 ); } - //{ - // QSpacerItem* aSpacerItem = new QSpacerItem( 16, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); - // aGridLayout->addItem( aSpacerItem, 3, 0 ); - //} } aTabWidget->addTab( aParent, tr( "NAVIGATION_TAB" ) ); @@ -238,10 +237,6 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI* theModule, aVBoxLayout->addLayout( aHBoxLayout ); } - //{ - // QSpacerItem* aSpacerItem = new QSpacerItem( 16, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); - // aVBoxLayout->addItem( aSpacerItem ); - //} aTabWidget->addTab( aParent, tr( "PROPERTIES_TAB" ) ); } @@ -254,6 +249,9 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI* theModule, //---------------------------------------------------------------------------- + myPlayPixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ); + myPausePixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PAUSE" ) ); + myTimer = new QTimer( this ); // Common @@ -288,27 +286,46 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI* theModule, QtxDockWidget* aQtxDockWidget = new QtxDockWidget( true, theParent ); theParent->addDockWidget( Qt::BottomDockWidgetArea , aQtxDockWidget ); aQtxDockWidget->setWidget( this ); - aQtxDockWidget->show(); + + myToggleViewAction = aQtxDockWidget->toggleViewAction(); + myToggleViewAction->setIcon( QIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PANEL" ) ) ) ); + myToggleViewAction->setToolTip( tr( "MEN_SLIDER_PANE" ) ); + myToggleViewAction->setText( tr( "MEN_SLIDER_PANE" ) ); + myToggleViewAction->setCheckable( true ); + + connect( myToggleViewAction, SIGNAL( toggled( bool ) ), this, SLOT( onToggleView( bool ) ) ); + //myToggleViewAction->setChecked( false ); } -/*! - Destructor -*/ + +//---------------------------------------------------------------------------- VisuGUI_Slider::~VisuGUI_Slider() { } + +//---------------------------------------------------------------------------- +QAction* VisuGUI_Slider::toggleViewAction() +{ + return myToggleViewAction; +} + + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onModuleDeactivated() { setHidden( true ); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onModuleActivated() { setHidden( false ); } +//---------------------------------------------------------------------------- void VisuGUI_Slider::onMemoryModeChanged( bool ) { using namespace VISU; @@ -325,12 +342,14 @@ void VisuGUI_Slider::onMemoryModeChanged( bool ) } +//---------------------------------------------------------------------------- void VisuGUI_Slider::onMemorySizeChanged( double ) { onMemoryModeChanged( myLimitedMemoryButton->isChecked() ); } +//---------------------------------------------------------------------------- bool VisuGUI_Slider::checkHolderList() { THolderList aHolderList; @@ -345,6 +364,8 @@ bool VisuGUI_Slider::checkHolderList() return myHolderList.empty(); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::enableControls( bool on ) { setEnabled( on ); @@ -422,6 +443,8 @@ void VisuGUI_Slider::enableControls( bool on ) } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::updateMemoryState() { if( checkHolderList() ) @@ -443,6 +466,8 @@ void VisuGUI_Slider::updateMemoryState() myFreeMemory->updateGeometry(); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onSelectionChanged() { //cout << "VisuGUI_Slider::onSelectionChanged()" << endl; @@ -482,18 +507,24 @@ void VisuGUI_Slider::onSelectionChanged() updateMemoryState(); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onTimeStampActivated( int value ) { mySlider->setValue( value ); onValueChanged( value ); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onFirst() { int value = mySlider->minimum(); mySlider->setValue( value ); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onPrevious() { int value = mySlider->value() - 1; @@ -501,12 +532,13 @@ void VisuGUI_Slider::onPrevious() mySlider->setValue( value ); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onPlay( bool on ) { - SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); if( on ) { - myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PAUSE" ) ) ); + myPlayButton->setIcon( myPlayPixmap ); int delay = int(5000.0 / double(mySpeedSlider->value())); myTimer->start( delay ); @@ -514,10 +546,22 @@ void VisuGUI_Slider::onPlay( bool on ) else { myTimer->stop(); - myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ) ); + myPlayButton->setIcon( myPausePixmap ); + } +} + + +//---------------------------------------------------------------------------- +void VisuGUI_Slider::onToggleView( bool on ) +{ + if ( !on ) { + onPlay( on ); + hide(); } } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onNext() { int value = mySlider->value() + 1; @@ -525,12 +569,16 @@ void VisuGUI_Slider::onNext() mySlider->setValue( value ); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onLast() { int value = mySlider->maximum(); mySlider->setValue( value ); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onValueChanged( int value ) { if( checkHolderList() ){ @@ -584,6 +632,8 @@ void VisuGUI_Slider::onValueChanged( int value ) updateMemoryState(); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onSpeedChanged( int value ) { if(myPlayButton->isChecked()){ @@ -592,6 +642,8 @@ void VisuGUI_Slider::onSpeedChanged( int value ) } } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onTimeout() { int value = mySlider->value(); @@ -600,3 +652,6 @@ void VisuGUI_Slider::onTimeout() else myPlayButton->setChecked( false ); } + + +//---------------------------------------------------------------------------- diff --git a/src/VISUGUI/VisuGUI_Slider.h b/src/VISUGUI/VisuGUI_Slider.h index 97397c5b..5adc197f 100644 --- a/src/VISUGUI/VisuGUI_Slider.h +++ b/src/VISUGUI/VisuGUI_Slider.h @@ -29,6 +29,7 @@ #define VisuGUI_Slider_HeaderFile #include +#include #include @@ -50,6 +51,7 @@ class QCheckBox; class QRadioButton; class QMainWindow; class QTimer; +class QAction; class QtxDoubleSpinBox; class LightApp_SelectionMgr; @@ -65,6 +67,8 @@ public: LightApp_SelectionMgr* theSelectionMgr ); virtual ~VisuGUI_Slider(); + + QAction* toggleViewAction(); public slots: virtual void onSelectionChanged(); @@ -83,6 +87,8 @@ public slots: virtual void onTimeout(); + virtual void onToggleView( bool ); + void onMemoryModeChanged( bool ); void onMemorySizeChanged( double ); @@ -127,6 +133,9 @@ private: THolderList myHolderList; QTimer* myTimer; + QPixmap myPlayPixmap; + QPixmap myPausePixmap; + QAction* myToggleViewAction; }; #endif diff --git a/src/VISUGUI/VisuGUI_Sweep.cxx b/src/VISUGUI/VisuGUI_Sweep.cxx index 3ad6ac65..520f1796 100644 --- a/src/VISUGUI/VisuGUI_Sweep.cxx +++ b/src/VISUGUI/VisuGUI_Sweep.cxx @@ -55,6 +55,7 @@ #include #include #include +#include #include @@ -78,6 +79,7 @@ VisuGUI_Sweep::VisuGUI_Sweep( VisuGUI* theModule, QVBoxLayout* aVBoxLayout = new QVBoxLayout( this ); QTabWidget* aTabWidget = new QTabWidget( this ); + aTabWidget->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ); aVBoxLayout->addWidget( aTabWidget ); { @@ -154,10 +156,6 @@ VisuGUI_Sweep::VisuGUI_Sweep( VisuGUI* theModule, aVBoxLayout->addLayout( aHBoxLayout ); } - //{ - // QSpacerItem* aSpacerItem = new QSpacerItem( 16, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); - // aVBoxLayout->addItem( aSpacerItem ); - //} aTabWidget->addTab( aNavigationTab, tr( "NAVIGATION_TAB" ) ); } @@ -210,9 +208,6 @@ VisuGUI_Sweep::VisuGUI_Sweep( VisuGUI* theModule, myStepDelay = new QtxDoubleSpinBox( aPropertiesTab ); myStepDelay->setValue( aResourceMgr->doubleValue("VISU", "sweeping_time_step", 0.1) ); aGridLayout->addWidget( myStepDelay, 2, 1, 1, 1 ); - - QSpacerItem* aSpacerItem = new QSpacerItem( 16, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); - aGridLayout->addItem( aSpacerItem, 3, 0 ); } aTabWidget->addTab( aPropertiesTab, tr( "PROPERTIES_TAB" ) ); @@ -228,12 +223,22 @@ VisuGUI_Sweep::VisuGUI_Sweep( VisuGUI* theModule, QtxDockWidget* aQtxDockWidget = new QtxDockWidget( true, theParent ); theParent->addDockWidget( Qt::BottomDockWidgetArea , aQtxDockWidget ); aQtxDockWidget->setWidget( this ); - aQtxDockWidget->show(); + myToggleViewAction = aQtxDockWidget->toggleViewAction(); + myToggleViewAction->setIcon( QIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SWEEP_PANEL" ) ) ) ); + myToggleViewAction->setToolTip( tr( "MEN_SWEEP_PANE" ) ); + myToggleViewAction->setText( tr( "MEN_SWEEP_PANE" ) ); + myToggleViewAction->setCheckable( true ); + + connect( myToggleViewAction, SIGNAL( toggled( bool ) ), this, SLOT( onToggleView( bool ) ) ); + //myToggleViewAction->setChecked( false ); //---------------------------------------------------------------------------- myTimer = new QTimer( this ); + myPlayPixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ); + myPausePixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PAUSE" ) ); + connect( myTimer, SIGNAL( timeout() ), SLOT( onTimeout() ) ); connect( myPlayButton, SIGNAL( toggled( bool ) ), SLOT( onPlay( bool ) ) ); @@ -253,8 +258,6 @@ VisuGUI_Sweep::VisuGUI_Sweep( VisuGUI* theModule, onSelectionChanged(); onModeChanged( mySweepMode->currentIndex() ); - - onPlay( true ); } @@ -263,6 +266,13 @@ VisuGUI_Sweep::~VisuGUI_Sweep() {} +//---------------------------------------------------------------------------- +QAction* VisuGUI_Sweep::toggleViewAction() +{ + return myToggleViewAction; +} + + //---------------------------------------------------------------------------- void VisuGUI_Sweep::onModuleDeactivated() { @@ -453,13 +463,23 @@ void VisuGUI_Sweep::onPlay( bool on ) { SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); if ( on ) { - myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PAUSE" ) ) ); + myPlayButton->setIcon( myPlayPixmap ); myTimer->start( int( myStepDelay->value() * 1000 ) ); myPlayButton->setChecked( true ); } else { myTimer->stop(); myPlayButton->setChecked( false ); - myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ) ); + myPlayButton->setIcon( myPausePixmap ); + } +} + + +//---------------------------------------------------------------------------- +void VisuGUI_Sweep::onToggleView( bool on ) +{ + if ( !on ) { + onPlay( on ); + hide(); } } diff --git a/src/VISUGUI/VisuGUI_Sweep.h b/src/VISUGUI/VisuGUI_Sweep.h index 6d03d71a..169e9c8b 100644 --- a/src/VISUGUI/VisuGUI_Sweep.h +++ b/src/VISUGUI/VisuGUI_Sweep.h @@ -29,6 +29,7 @@ #define VisuGUI_Sweep_HeaderFile #include +#include class QComboBox; class QToolButton; @@ -37,6 +38,7 @@ class QSpinBox; class QCheckBox; class QMainWindow; class QTimer; +class QAction; class QtxIntSpinBox; class QtxDoubleSpinBox; @@ -65,6 +67,8 @@ public: virtual ~VisuGUI_Sweep(); + QAction* toggleViewAction(); + public slots: virtual void onSelectionChanged(); @@ -90,6 +94,8 @@ public slots: virtual void onTimeout(); + virtual void onToggleView( bool ); + void onModuleDeactivated(); void onModuleActivated(); @@ -112,6 +118,9 @@ private: QtxDoubleSpinBox* myStepDelay; QTimer* myTimer; + QPixmap myPlayPixmap; + QPixmap myPausePixmap; + QAction* myToggleViewAction; VisuGUI* myModule; -- 2.39.2