From 3103847c2bfca9e06d93cc6db9a121e6c5521bb0 Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 7 Jul 2005 07:29:24 +0000 Subject: [PATCH] Some methods for view parameters management have been added. Old methods are not removed, but they don't work now because of new desktop organization principles --- idl/VISU_Gen.idl | 562 +++++++++++++++++++++++--------------- src/VISU_I/VISU_View_i.cc | 285 +++++++++++++++++-- src/VISU_I/VISU_View_i.hh | 31 ++- 3 files changed, 618 insertions(+), 260 deletions(-) diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index 73c90136..96811492 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -1121,344 +1121,454 @@ Creates a presentation form containing an array of references to the curves. void DeletePrs3d(in Prs3d thePrs3d); }; -/*! \brief %View interface - Contains a set of methods used by the %View frame, which can be one of - the following types: 3d, Table, XY plot. - %View interface is a base for all types of %view interfaces. -*/ - interface View: Base{ - - enum ViewRepresentation { OBJECTBROWSER, VIEWER, PYTHON, MESSAGES }; // displaying part ("ALL" isn't setable) + /*! \brief %View interface + * + * Contains a set of methods used by the %View frame, which can be one of + * the following types: 3d, Table, XY plot. + * %View interface is a base for all types of %view interfaces. + */ + interface View: Base { + + /*! \brief %ViewRepresentation enumeration + * + * displaying part ("ALL" isn't setable) + */ + enum ViewRepresentation { + OBJECTBROWSER, + VIEWER, + PYTHON, + MESSAGES + }; void ShowPart (in ViewRepresentation ViewRepr, in boolean state ); boolean IsPartShown( in ViewRepresentation ViewRepr ); /*! - * Horizontally split workarea of this view. This view is moved in a new right area. + * New methods for view parameters management. + */ + + /*! \brief Split workarea of this view. + * + * Horizontally split workarea of this view. + * This view is moved in a new right area. */ void SplitRight(); - /*! - * Vertically split workarea of this view. This view is moved in a new bottom area. + /*! \brief Split workarea of this view. + * + * Horizontally split workarea of this view. + * This view stays in an old left area, others are moved in a new right area. + */ + void SplitLeft(); + + /*! \brief Split workarea of this view. + * + * Vertically split workarea of this view. + * This view is moved in a new bottom area. */ void SplitBottom(); - // begin: old methods, they don't work now + /*! \brief Split workarea of this view. + * + * Vertically split workarea of this view. + * This view stays in an old top area, others are moved in a new bottom area. + */ + void SplitTop(); + + /*! + * Put this view window on top of its work area. + */ + void OnTop(); + + /*! + * Put \a theView in workarea of this view right after it. + * If \a theView was alone in its workarea, workarea of \a theView will be destroyed. + * If \a theView was in the same workarea with this view, simple reordering will take place. + * \param theView A view window to be attracted to this one. + */ + void Attract (in View theView); + + /*! + * Put all the view windows from workarea of \a theView in workarea of this view right after it. + * Workarea of \a theView will be destroyed. + * If \a theView was in the same workarea with this view, simple reordering will take place. + * \param theView A view window to be attracted to this one together with all its workarea. + */ + void AttractAll (in View theView); + + /*! + * Set position of this view window relatively its splitter. + * \param thePosition Desired position of this view window relatively + * its splitter. Meaningfull values lays in range [0..1]. + * + * Direction of positioning is defined by the splitter orientation. + */ + void SetRelativePositionInSplitter (in double thePosition); + + /*! + * Set size of this view window relatively its splitter. + * \param theSize Desired size of this view window relatively + * its splitter. Meaningfull values lays in range [0..1]. + * + * Direction of resizing is defined by the splitter orientation. + */ + void SetRelativeSizeInSplitter (in double theSize); + + /*! + * Set horizontal position of this view window relatively its workstack. + * \param thePosition Desired horizontal position of this view window + * relatively its workstack. Meaningfull values lays in range [0..1]. + */ + void SetRelativePositionX (in double thePosition); + + /*! + * Set vertical position of this view window relatively its workstack. + * \param thePosition Desired vertical position of this view window + * relatively its workstack. Meaningfull values lays in range [0..1]. + */ + void SetRelativePositionY (in double thePosition); + + /*! + * Set horizontal size of this view window relatively its workstack. + * \param theSize Desired horizontal size of this view window relatively + * its workstack. Meaningfull values lays in range [0..1]. + */ + void SetRelativeSizeX (in double theSize); + + /*! + * Set vertical size of this view window relatively its workstack. + * \param theSize Desired vertical size of this view window relatively + * its workstack. Meaningfull values lays in range [0..1]. + */ + void SetRelativeSizeY (in double theSize); + + /*! + * Old methods for view parameters management, they don't work now + */ void SetViewWidth (in long Width); //setting width of view - void SetViewHeight (in long Height); //setting height of view - long GetViewWidth(); //getting view width - long GetViewHeight(); //getting view height - enum ViewPosition {TOP, CENTER, BOTTOM, RIGHT, LEFT}; //position of the study frame - void SetViewPositionHorizontal (in ViewPosition ViewPosHor); //setting of the horizontal view position - void SetViewPositionVertical (in ViewPosition ViewPosVer); //setting of the vertical view position - void SetRelativePosition( in double x, in double y ); void SetRelativeSize( in double x, in double y ); - // end: old methods, they don't work now + void Minimize(); // Minimizes to the task bar or to the bottom of the Desktop the %View frame. + void Restore(); // Restores the %View frame. + void Maximize(); // Maximizes the %View frame. /*! - Sets the title of the %View frame. - \param theTitle String parameter defining the title of the %View frame. - */ + * Sets the title of the %View frame. + * \param theTitle String parameter defining the title of the %View frame. + */ void SetTitle(in string theTitle); + /*! - Gets the title of the %View frame. - */ + * Gets the title of the %View frame. + */ string GetTitle(); + /*! - Sets background color of the %View frame. - \param theColor Background color defined in SALOMEDS::Color enumeration. - */ + * Sets background color of the %View frame. + * \param theColor Background color defined in SALOMEDS::Color enumeration. + */ void SetBackground(in SALOMEDS::Color theColor); + /*! - Gets background color of the %View frame. - */ + * Gets background color of the %View frame. + */ SALOMEDS::Color GetBackground(); + /*! - Minimizes to the task bar or to the bottom of the Desktop the %View frame. - */ - void Minimize(); - /*! - Restores the %View frame. - */ - void Restore(); - /*! - Maximizes the %View frame. - */ - void Maximize(); - /*! - Removes all presentations (presentable objects) from the %view. - */ + * Removes all presentations (presentable objects) from the %view. + */ void EraseAll(); + /*! - Displays all presentations (presentable objects) in the %view. - */ + * Displays all presentations (presentable objects) in the %view. + */ void DisplayAll(); + /*! - Removes a definite presentation (presentable object) from the %view. - \param thePrsObj The presentation (presentable object) which should be deleted. - */ + * Removes a definite presentation (presentable object) from the %view. + * \param thePrsObj The presentation (presentable object) which should be deleted. + */ void Erase(in PrsObject thePrsObj); + /*! - Displays a definite presentation (presentable object) in the %view. - \param thePrsObj The presentation (presentable object) which should be displayed. - */ + * Displays a definite presentation (presentable object) in the %view. + * \param thePrsObj The presentation (presentable object) which should be displayed. + */ void Display(in PrsObject thePrsObj); + /*! - Allows to display only a definite presentation (presentable object) in the %view. - All other presentations are removed from the %view. - \param thePrsObj The presentation (presentable object) which should be displayed. - */ + * Allows to display only a definite presentation (presentable object) in the %view. + * All other presentations are removed from the %view. + * \param thePrsObj The presentation (presentable object) which should be displayed. + */ void DisplayOnly(in PrsObject thePrsObj); + /*! - Updates the view. - */ + * Updates the view. + */ void Update(); /*! - Saves the view. - \param theFileName The name of the file where the view will be saved. - \return True, if the view have been saved successfully. - */ + * Saves the view. + * \param theFileName The name of the file where the view will be saved. + * \return True, if the view have been saved successfully. + */ boolean SavePicture(in string theFileName); }; //------------------------------------------------------- -/*! \brief 3D view interface - -This interface contains a set of methods necessary for representation of objects in 3D space. -*/ - + /*! \brief 3D view interface + * + * This interface contains a set of methods necessary for representation of objects in 3D space. + */ interface View3D : View { -/*! -This enumeration contains a set of elements determining a predefined point of view - (position of the camera in 3D space relative to the presentable object). -*/ + /*! + * This enumeration contains a set of elements determining a predefined point of view + * (position of the camera in 3D space relative to the presentable object). + */ enum ViewType{ FRONT, BACK, LEFT, RIGHT, TOP, BOTTOM}; -/*! -This enumeration contains a set of elements determining the axis -*/ + + /*! + * This enumeration contains a set of elements determining the axis + */ enum Axis{ XAxis, YAxis, ZAxis}; -/*! -Data type defining coordinates in 3D space. -*/ - typedef double XYZ[3]; -/*! - Makes all presentations, which are currently present in the %view, completely visible. -*/ + /*! + * Data type defining coordinates in 3D space. + */ + typedef double XYZ[3]; + /*! + * Makes all presentations, which are currently present in the %view, completely visible. + */ void FitAll(); -/*! -Sets a predefined point of view (FRONT, BACK, LEFT, RIGHT, TOP, BOTTOM). (In other words it means - a predefined position of the camera in 3D space with respect to the object which is represented.) -*/ + /*! + * Sets a predefined point of view (FRONT, BACK, LEFT, RIGHT, TOP, BOTTOM). (In other words it means + * a predefined position of the camera in 3D space with respect to the object which is represented.) + */ void SetView(in ViewType theType); -/*! -Sets the position of the camera in 3D space. This point is used as the first point of the vector defining -the view direction of the camera. -*/ + /*! + * Sets the position of the camera in 3D space. + * This point is used as the first point of the vector + * defining the view direction of the camera. + */ void SetPointOfView(in XYZ theCoord); -/*! -Gets the position of the camera in 3D space.This point is used as the first point of the vector defining -the view direction of the camera. -*/ + + /*! + * Gets the position of the camera in 3D space. + * This point is used as the first point of the vector + * defining the view direction of the camera. + */ XYZ GetPointOfView(); -/*! -Sets the vertical line of the camera in 3D space. -*/ + + /*! + * Sets the vertical line of the camera in 3D space. + */ void SetViewUp(in XYZ theDir); -/*! -Gets the vertical line of the camera in 3D space. -*/ + + /*! + * Gets the vertical line of the camera in 3D space. + */ XYZ GetViewUp(); -/*! -Sets the point of sight of the camera. This point is used as the second point of the vector defining -the view direction of the camera. -*/ + + /*! + * Sets the point of sight of the camera. This point is used as the + * second point of the vector defining the view direction of the camera. + */ void SetFocalPoint(in XYZ theDir); -/*! -Gets the point of sight of the camera. This point is used as the second point of the vector defining -the view direction of the camera. -*/ + + /*! + * Gets the point of sight of the camera. This point is used as the + * second point of the vector defining the view direction of the camera. + */ XYZ GetFocalPoint(); -/*! -Zooming of the presentable object. Sets the scale. -*/ + + /*! + * Zooming of the presentable object. Sets the scale. + */ void SetParallelScale(in double theScale); -/*! -Zooming of the presentable object. Gets the scale. -*/ + + /*! + * Zooming of the presentable object. Gets the scale. + */ double GetParallelScale(); -/*! -Scaling of the view along a definite axis. -\param theAxis The axis of the scaling -\param theParam The coefficient of the scaling -*/ + + /*! + * Scaling of the view along a definite axis. + * \param theAxis The axis of the scaling + * \param theParam The coefficient of the scaling + */ void ScaleView(in Axis theAxis, in double theParam); -/*! -Removes the scaling of the view. -*/ + + /*! + * Removes the scaling of the view. + */ void RemoveScale(); -/*! -Saves view parameters. -\return True if the view parameters have been created, False if the parameters have been modified. -\param theName The name under which the view parameters will be saved. -*/ + + /*! + * Saves view parameters. + * \return True if the view parameters have been created, False if the parameters have been modified. + * \param theName The name under which the view parameters will be saved. + */ boolean SaveViewParams(in string theName); -/*! Restores view parameters. -\return True if the view parameters have been found and applied to the view, -False if the parameters with this name don't exist. -\param theName The name of the view parameters which will be restored. -*/ + + /*! Restores view parameters. + * \return True if the view parameters have been found and applied to the view, + * False if the parameters with this name don't exist. + * \param theName The name of the view parameters which will be restored. + */ boolean RestoreViewParams(in string theName); }; - //------------------------------------------------------- -/*! \brief Interface of the Table view - -This interface is used for creation of a view necessary for presentation of a table. -*/ + /*! \brief Interface of the Table view + * + * This interface is used for creation of a view necessary for presentation of a table. + */ interface TableView : View { - }; - //------------------------------------------------------- -/*! \brief Interface of the 2D plot view - -This interface is used for creation of a view necessary for presentation of a XY plot generated on the basis -of one or several curve lines. -*/ + /*! \brief Interface of the 2D plot view + * + * This interface is used for creation of a view necessary for presentation + * of a XY plot generated on the basis of one or several curve lines. + */ interface XYPlot : View { -/*! Sets the title of the XY plot -\param theTitle The title of the XY plot -*/ - + /*! Sets the title of the XY plot + * \param theTitle The title of the XY plot + */ void SetSubTitle(in string theTitle); -/*! Gets the title of the XY plot -*/ + + /*! Gets the title of the XY plot + */ string GetSubTitle(); -/*! -This enumeration contains a set of elements determining the type of the curve lines, which -will be displayed in your XY plot. -*/ + + /*! + * This enumeration contains a set of elements determining the type + * of the curve lines, which will be displayed in your XY plot. + */ enum CurveType { POINTS, MULTYLINE, SPLINE}; -/*! Sets the type of the curve lines. -\param theType The type of the curve lines taken from CurveType enumeration. -*/ - void SetCurveType(in CurveType theType); -/*! Gets the type of the curve lines. + /*! Sets the type of the curve lines. + * \param theType The type of the curve lines taken from CurveType enumeration. + */ + void SetCurveType(in CurveType theType); -*/ + /*! Gets the type of the curve lines. + */ CurveType GetCurveType(); -/*! Sets the size of the markers (data points) with help of -which the curve is constructed on the graphics. -\param theSize Long value defining the size of the markers. -*/ + + /*! Sets the size of the markers (data points) with help of + * which the curve is constructed on the graphics. + * \param theSize Long value defining the size of the markers. + */ void SetMarkerSize(in long theSize); -/*! Gets the size of the markers (data points) with help of -which the curve is constructed on the graphics. -*/ + + /*! Gets the size of the markers (data points) with help of + * which the curve is constructed on the graphics. + */ long GetMarkerSize(); -/*! Enable/disables X-axis grid of the 2D plot. -*/ + + /*! Enable/disables X-axis grid of the 2D plot. + */ void EnableXGrid(in boolean theMajor, in long theNumMajor, in boolean theMinor, in long theNumMinor); -/*! Enable/disables Y-axis grid of the 2D plot. -*/ + /*! Enable/disables Y-axis grid of the 2D plot. + */ void EnableYGrid(in boolean theMajor, in long theNumMajor, in boolean theMinor, in long theNumMinor); -/*! Sets horizontal scaling of the 2D plot. -\param theScaling Type of scaling taken from Scaling enumeration. -*/ + /*! Sets horizontal scaling of the 2D plot. + * \param theScaling Type of scaling taken from Scaling enumeration. + */ void SetHorScaling(in Scaling theScaling); -/*! Gets the type horizontal scaling of the 2D plot. -*/ + + /*! Gets the type horizontal scaling of the 2D plot. + */ Scaling GetHorScaling(); -/*! Sets vertical scaling of the 2D plot. -\param theScaling Type of scaling taken from Scaling enumeration. -*/ + + /*! Sets vertical scaling of the 2D plot. + * \param theScaling Type of scaling taken from Scaling enumeration. + */ void SetVerScaling(in Scaling theScaling); -/*! Gets the type vertical scaling of the 2D plot. -*/ + + /*! Gets the type vertical scaling of the 2D plot. + */ Scaling GetVerScaling(); -/*! Sets the title of the X-axis of the plot. -\param theTitle String value defining the title of the X-axis of the plot. -*/ + /*! Sets the title of the X-axis of the plot. + * \param theTitle String value defining the title of the X-axis of the plot. + */ void SetXTitle(in string theTitle); -/*! Gets the title of the X-axis of the plot. -*/ + + /*! Gets the title of the X-axis of the plot. + */ string GetXTitle(); -/*! Sets the title of the Y-axis of the plot. -\param theTitle String value defining the title of the X-axis of the plot. -*/ + + /*! Sets the title of the Y-axis of the plot. + * \param theTitle String value defining the title of the X-axis of the plot. + */ void SetYTitle(in string theTitle); -/*! Gets the title of the Y-axis of the plot. -*/ + + /*! Gets the title of the Y-axis of the plot. + */ string GetYTitle(); -/*! Shows/hides the legend (description) of the 2D plot. -*/ + + /*! Shows/hides the legend (description) of the 2D plot. + */ void ShowLegend(in boolean theShowing); -/*! Shrinks and enlarges the 2D plot to fit the 2D viewer. -*/ + + /*! Shrinks and enlarges the 2D plot to fit the 2D viewer. + */ void FitAll(); }; //------------------------------------------------------- -/*! \brief Interface of the %ViewManager - - The %ViewManager is necessary for work with view windows (creation and deletion). -*/ - - interface ViewManager: Base{ -/*! \brief Getting an active %View Frame - - Returns an object reference to the active %View Frame. - Type of the %View must be checked. - \note
Returns nil if there are no views currently opened. -*/ - + /*! \brief Interface of the %ViewManager + * + * The ViewManager is necessary for work with view windows (creation and deletion). + */ + interface ViewManager: Base { + /*! \brief Getting an active %View Frame + * + * Returns an object reference to the active %View Frame. + * Type of the %View must be checked. + * \note
Returns nil if there are no views currently opened. + */ View GetCurrentView(); -/*! \brief Creation of a 3d %View. - Returns an object reference to the newly created 3D %View. -*/ + /*! \brief Creation of a 3d %View. + * + * Returns an object reference to the newly created 3D %View. + */ View3D Create3DView(); -/*! \brief Creation of a Table %View. - - Returns an object reference to the newly created Table %View. -*/ + /*! \brief Creation of a Table %View. + * + * Returns an object reference to the newly created Table %View. + */ TableView CreateTableView(in Table theTable); -/*! \brief Creation of a 2D plot %View. - - Returns an object reference to the newly created 2D plot %View. -*/ - + /*! \brief Creation of a 2D plot %View. + * + * Returns an object reference to the newly created 2D plot %View. + */ XYPlot CreateXYPlot(); -/*! Deletes a definite view. -\param theView The view which should be deleted. -*/ + /*! Deletes a definite view. + * \param theView The view which should be deleted. + */ void Destroy(in View theView); - - }; + }; }; #endif - - diff --git a/src/VISU_I/VISU_View_i.cc b/src/VISU_I/VISU_View_i.cc index 5db38082..6f010f91 100644 --- a/src/VISU_I/VISU_View_i.cc +++ b/src/VISU_I/VISU_View_i.cc @@ -209,51 +209,33 @@ namespace VISU { return ProcessEvent(new TPartShownEvent(myApplication,theViewRepresentation)); } - enum SplitSide {SPLIT_LEFT, SPLIT_RIGHT, SPLIT_TOP, SPLIT_BOTTOM}; - + // Begin: New methods for view parameters management struct TSplitEvent: public SALOME_Event { SalomeApp_Application * myApplication; SUIT_ViewWindow * myViewWindow; - SplitSide mySplitSide; + Qt::Orientation myOrientation; + QtxWorkstack::SplitType mySplitType; public: TSplitEvent (SalomeApp_Application * theApplication, SUIT_ViewWindow * theViewWindow, - SplitSide theSplitSide): + Qt::Orientation theOrientation, + QtxWorkstack::SplitType theSplitType): myApplication(theApplication), myViewWindow(theViewWindow), - mySplitSide(theSplitSide) + myOrientation(theOrientation), + mySplitType(theSplitType) {} - virtual - void - Execute() + virtual void Execute() { - MESSAGE("TSplitEvent::Execute()"); SUIT_Desktop* desk = myApplication->desktop(); STD_TabDesktop* tabDesk = dynamic_cast(desk); if (tabDesk) { - MESSAGE("TSplitEvent::Execute() - tabDesk"); QtxWorkstack* workstack = tabDesk->workstack(); if (workstack) { - MESSAGE("TSplitEvent::Execute() - workstack"); - QWidgetList vws = workstack->splitWindowList(); - if (vws.count() > 1) { - MESSAGE("TSplitEvent::Execute() - vws.count() > 1"); - //jfa tmp:workstack->windowActivated(myViewWindow); - //??? to do: set workarea of this vw as active area - switch (mySplitSide) { - case SPLIT_LEFT: - case SPLIT_RIGHT: - workstack->split(Qt::Horizontal); - break; - case SPLIT_TOP: - case SPLIT_BOTTOM: - workstack->split(Qt::Vertical); - break; - } - } + workstack->Split(myViewWindow, myOrientation, mySplitType); } } } @@ -263,16 +245,260 @@ namespace VISU { View_i:: SplitRight() { - ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow,SPLIT_RIGHT)); + ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow, + Qt::Horizontal,QtxWorkstack::SPLIT_MOVE)); + } + + void + View_i:: + SplitLeft() + { + ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow, + Qt::Horizontal,QtxWorkstack::SPLIT_STAY)); } void View_i:: SplitBottom() { - ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow,SPLIT_BOTTOM)); + ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow, + Qt::Vertical,QtxWorkstack::SPLIT_MOVE)); + } + + void + View_i:: + SplitTop() + { + ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow, + Qt::Vertical,QtxWorkstack::SPLIT_STAY)); + } + + void + View_i:: + OnTop() + { + struct TOnTopEvent: public SALOME_Event + { + SalomeApp_Application * myApplication; + SUIT_ViewWindow * myViewWindow; + + public: + TOnTopEvent (SalomeApp_Application * theApplication, + SUIT_ViewWindow * theViewWindow): + myApplication(theApplication), + myViewWindow(theViewWindow) + {} + + virtual void Execute() + { + SUIT_Desktop* desk = myApplication->desktop(); + STD_TabDesktop* tabDesk = dynamic_cast(desk); + if (tabDesk) { + QtxWorkstack* workstack = tabDesk->workstack(); + if (workstack) { + workstack->OnTop(myViewWindow); + } + } + } + }; + + ProcessVoidEvent(new TOnTopEvent(myApplication,myViewWindow)); + } + + struct TAttractEvent: public SALOME_Event + { + SalomeApp_Application * myApplication; + SUIT_ViewWindow * myViewWindow1; + SUIT_ViewWindow * myViewWindow2; + bool myAttractAll; + + public: + TAttractEvent (SalomeApp_Application * theApplication, + SUIT_ViewWindow * theViewWindow1, + SUIT_ViewWindow * theViewWindow2, + bool theAttractAll): + myApplication(theApplication), + myViewWindow1(theViewWindow1), + myViewWindow2(theViewWindow2), + myAttractAll(theAttractAll) + {} + + virtual void Execute() + { + SUIT_Desktop* desk = myApplication->desktop(); + STD_TabDesktop* tabDesk = dynamic_cast(desk); + if (tabDesk) { + QtxWorkstack* workstack = tabDesk->workstack(); + if (workstack) { + workstack->Attract(myViewWindow1, myViewWindow2, myAttractAll); + } + } + } + }; + + void + View_i:: + Attract (VISU::View_ptr theView) + { + if (!CORBA::is_nil(theView)) { + if (VISU::View_i* pView = dynamic_cast(VISU::GetServant(theView).in())) { + ProcessVoidEvent(new TAttractEvent(myApplication,myViewWindow,pView->myViewWindow,false)); + } + } + } + + void + View_i:: + AttractAll (VISU::View_ptr theView) + { + if (!CORBA::is_nil(theView)) { + if (VISU::View_i* pView = dynamic_cast(VISU::GetServant(theView).in())) { + ProcessVoidEvent(new TAttractEvent(myApplication,myViewWindow,pView->myViewWindow,true)); + } + } + } + + struct TSizePositionEvent: public SALOME_Event + { + SalomeApp_Application * myApplication; + SUIT_ViewWindow * myViewWindow; + double myValue; + bool myIsSize; + + public: + TSizePositionEvent (SalomeApp_Application * theApplication, + SUIT_ViewWindow * theViewWindow, + double theValue, + bool theIsSize): + myApplication(theApplication), + myViewWindow(theViewWindow), + myValue(theValue), + myIsSize(theIsSize) + {} + + virtual void Execute() + { + MESSAGE("TSizePositionEvent::Execute()"); + SUIT_Desktop* desk = myApplication->desktop(); + STD_TabDesktop* tabDesk = dynamic_cast(desk); + if (tabDesk) { + QtxWorkstack* workstack = tabDesk->workstack(); + if (workstack) { + if (myIsSize) { + //jfa to do:workstack->SetRelativeSizeInSplitter(myViewWindow, myValue); + } else { + workstack->SetRelativePositionInSplitter(myViewWindow, myValue); + } + } + } + } + }; + + void + View_i:: + SetRelativePositionInSplitter (CORBA::Double thePosition) + { + if (thePosition < 0.0 || 1.0 < thePosition) { + return; + } + ProcessVoidEvent(new TSizePositionEvent(myApplication,myViewWindow,thePosition,false)); + } + + void + View_i:: + SetRelativeSizeInSplitter (CORBA::Double theSize) + { + if (theSize < 0.0 || 1.0 < theSize) { + return; + } + ProcessVoidEvent(new TSizePositionEvent(myApplication,myViewWindow,theSize,true)); + } + + struct TWSSizePositionEvent: public SALOME_Event + { + SalomeApp_Application * myApplication; + SUIT_ViewWindow * myViewWindow; + Qt::Orientation myOrientation; + double myValue; + bool myIsSize; + + public: + TWSSizePositionEvent (SalomeApp_Application * theApplication, + SUIT_ViewWindow * theViewWindow, + Qt::Orientation theOrientation, + double theValue, + bool theIsSize): + myApplication(theApplication), + myViewWindow(theViewWindow), + myOrientation(theOrientation), + myValue(theValue), + myIsSize(theIsSize) + {} + + virtual void Execute() + { + MESSAGE("TWSSizePositionEvent::Execute()"); + SUIT_Desktop* desk = myApplication->desktop(); + STD_TabDesktop* tabDesk = dynamic_cast(desk); + if (tabDesk) { + QtxWorkstack* workstack = tabDesk->workstack(); + if (workstack) { + if (myIsSize) { + //jfa to do:workstack->SetRelativeSize(myViewWindow, myOrientation, myValue); + } else { + workstack->SetRelativePosition(myViewWindow, myOrientation, myValue); + } + } + } + } + }; + + void + View_i:: + SetRelativePositionX (CORBA::Double thePosition) + { + if (thePosition < 0.0 || 1.0 < thePosition) { + return; + } + ProcessVoidEvent(new TWSSizePositionEvent(myApplication,myViewWindow, + Qt::Horizontal,thePosition,false)); + } + + void + View_i:: + SetRelativePositionY (CORBA::Double thePosition) + { + if (thePosition < 0.0 || 1.0 < thePosition) { + return; + } + ProcessVoidEvent(new TWSSizePositionEvent(myApplication,myViewWindow, + Qt::Vertical,thePosition,false)); + } + + void + View_i:: + SetRelativeSizeX (CORBA::Double theSize) + { + if (theSize < 0.0 || 1.0 < theSize) { + return; + } + ProcessVoidEvent(new TWSSizePositionEvent(myApplication,myViewWindow, + Qt::Horizontal,theSize,true)); + } + + void + View_i:: + SetRelativeSizeY (CORBA::Double theSize) + { + if (theSize < 0.0 || 1.0 < theSize) { + return; + } + ProcessVoidEvent(new TWSSizePositionEvent(myApplication,myViewWindow, + Qt::Vertical,theSize,true)); } + // End: New methods for view parameters management + // Begin: Old methods for view parameters management, they don't work now struct TSetViewSize: public SALOME_Event { SUIT_ViewWindow* myViewWindow; @@ -511,6 +737,7 @@ namespace VISU { if (myWorkspace) ProcessVoidEvent(new TEvent(myViewWindow,myWorkspace,theX,theY)); } + // End: Old methods for view parameters management, they don't work now void View_i:: diff --git a/src/VISU_I/VISU_View_i.hh b/src/VISU_I/VISU_View_i.hh index 67691d22..ae1f245b 100644 --- a/src/VISU_I/VISU_View_i.hh +++ b/src/VISU_I/VISU_View_i.hh @@ -61,32 +61,53 @@ namespace VISU virtual ~View_i(); public: - virtual void ShowPart( VISU::View::ViewRepresentation ViewRepr, CORBA::Boolean state ); + virtual void ShowPart( VISU::View::ViewRepresentation ViewRepr, CORBA::Boolean state ); virtual CORBA::Boolean IsPartShown( VISU::View::ViewRepresentation ViewRepr ); + // Begin: New methods for view parameters management virtual void SplitRight(); + virtual void SplitLeft(); virtual void SplitBottom(); + virtual void SplitTop(); + virtual void OnTop(); + + virtual void Attract (VISU::View_ptr theView); + virtual void AttractAll(VISU::View_ptr theView); + + virtual void SetRelativePositionInSplitter(CORBA::Double thePosition); + virtual void SetRelativeSizeInSplitter(CORBA::Double theSize); + + virtual void SetRelativePositionX(CORBA::Double thePosition); + virtual void SetRelativePositionY(CORBA::Double thePosition); + + virtual void SetRelativeSizeX(CORBA::Double theSize); + virtual void SetRelativeSizeY(CORBA::Double theSize); + // End: New methods for view parameters management + + // Begin: Old methods for view parameters management, they don't work now virtual void SetViewWidth(CORBA::Long Width); virtual void SetViewHeight(CORBA::Long Height); virtual CORBA::Long GetViewWidth(); virtual CORBA::Long GetViewHeight(); virtual void SetViewPositionHorizontal(VISU::View::ViewPosition ViewPosHor); virtual void SetViewPositionVertical(VISU::View::ViewPosition ViewPosVer); - virtual void SetRelativePosition( CORBA::Double x, CORBA::Double y ); virtual void SetRelativeSize( CORBA::Double x, CORBA::Double y ); - - virtual void SetBackground(const SALOMEDS::Color& theColor); - virtual SALOMEDS::Color GetBackground(); virtual void Minimize(); virtual void Restore(); virtual void Maximize(); + // End: Old methods for view parameters management, they don't work now + + virtual void SetBackground(const SALOMEDS::Color& theColor); + virtual SALOMEDS::Color GetBackground(); + virtual void EraseAll(); virtual void DisplayAll(); virtual void Erase(PrsObject_ptr thePrsObj); virtual void Display(PrsObject_ptr thePrsObj); virtual void DisplayOnly(PrsObject_ptr thePrsObj); + virtual void Update(); virtual CORBA::Boolean SavePicture(const char* theFileName); -- 2.39.2