Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
6de16523
Commit
6de16523
authored
Mar 16, 2013
by
Sebastian Eichelbaum
Browse files
[CHANGE
#255
] colormapper dock now uses dock title for its widgets
parent
cb4d7dd6
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
119 additions
and
13 deletions
+119
-13
resources/qt4gui/share/openwalnut/qt4gui/go-bottom.png
resources/qt4gui/share/openwalnut/qt4gui/go-bottom.png
+0
-0
resources/qt4gui/share/openwalnut/qt4gui/go-down.png
resources/qt4gui/share/openwalnut/qt4gui/go-down.png
+0
-0
resources/qt4gui/share/openwalnut/qt4gui/go-top.png
resources/qt4gui/share/openwalnut/qt4gui/go-top.png
+0
-0
resources/qt4gui/share/openwalnut/qt4gui/go-up.png
resources/qt4gui/share/openwalnut/qt4gui/go-up.png
+0
-0
src/core/graphicsEngine/WGEColormapping.cpp
src/core/graphicsEngine/WGEColormapping.cpp
+56
-0
src/core/graphicsEngine/WGEColormapping.h
src/core/graphicsEngine/WGEColormapping.h
+16
-0
src/qt4gui/controlPanel/WQtColormapper.cpp
src/qt4gui/controlPanel/WQtColormapper.cpp
+37
-10
src/qt4gui/controlPanel/WQtColormapper.h
src/qt4gui/controlPanel/WQtColormapper.h
+10
-3
No files found.
resources/qt4gui/share/openwalnut/qt4gui/go-bottom.png
0 → 100644
View file @
6de16523
1.43 KB
resources/qt4gui/share/openwalnut/qt4gui/go-down.png
0 → 100644
View file @
6de16523
1.33 KB
resources/qt4gui/share/openwalnut/qt4gui/go-top.png
0 → 100644
View file @
6de16523
1.42 KB
resources/qt4gui/share/openwalnut/qt4gui/go-up.png
0 → 100644
View file @
6de16523
1.36 KB
src/core/graphicsEngine/WGEColormapping.cpp
View file @
6de16523
...
...
@@ -345,6 +345,62 @@ bool WGEColormapping::moveUp( osg::ref_ptr< WGETexture3D > texture )
return
true
;
}
bool
WGEColormapping
::
moveToTop
(
osg
::
ref_ptr
<
WGETexture3D
>
texture
)
{
TextureContainerType
::
WriteTicket
w
=
m_textures
.
getWriteTicket
();
// does the texture exist?
TextureContainerType
::
Iterator
iter
=
std
::
find
(
w
->
get
().
begin
(),
w
->
get
().
end
(),
texture
);
if
(
iter
==
w
->
get
().
end
()
)
{
return
false
;
}
// is it already the first item?
if
(
iter
==
w
->
get
().
begin
()
)
{
return
false
;
}
// do the op
w
->
get
().
erase
(
iter
);
w
->
get
().
insert
(
w
->
get
().
begin
(),
texture
);
// unlock and call callbacks
w
.
reset
();
m_sortSignal
();
return
true
;
}
bool
WGEColormapping
::
moveToBottom
(
osg
::
ref_ptr
<
WGETexture3D
>
texture
)
{
TextureContainerType
::
WriteTicket
w
=
m_textures
.
getWriteTicket
();
// does the texture exist?
TextureContainerType
::
Iterator
iter
=
std
::
find
(
w
->
get
().
begin
(),
w
->
get
().
end
(),
texture
);
if
(
iter
==
w
->
get
().
end
()
)
{
return
false
;
}
// is it already the last item?
if
(
iter
+
1
==
w
->
get
().
end
()
)
{
return
false
;
}
// do the op
w
->
get
().
erase
(
iter
);
w
->
get
().
push_back
(
texture
);
// unlock and call callbacks
w
.
reset
();
m_sortSignal
();
return
true
;
}
size_t
WGEColormapping
::
size
()
const
{
return
m_textures
.
size
();
...
...
src/core/graphicsEngine/WGEColormapping.h
View file @
6de16523
...
...
@@ -190,6 +190,22 @@ public:
template
<
typename
Comparator
>
void
sort
(
Comparator
comp
);
/**
* Move the specified texture up in the list, directly to the top. Causes the sort signal to fire.
*
* \param texture the texture swapped with its ascendant
* \return true if swap was successful. False if not (texture not found, texture already at beginning).
*/
bool
moveToTop
(
osg
::
ref_ptr
<
WGETexture3D
>
texture
);
/**
* Move the specified texture down in the list, directly to the bottom. Causes the sort signal to fire.
*
* \param texture the texture swapped with its descendant
* \return true if swap was successful. False if not (texture not found, texture already at end).
*/
bool
moveToBottom
(
osg
::
ref_ptr
<
WGETexture3D
>
texture
);
/**
* Move the specified texture one item up in the list. Causes the sort signal to fire.
*
...
...
src/qt4gui/controlPanel/WQtColormapper.cpp
View file @
6de16523
...
...
@@ -44,6 +44,8 @@
#include "core/graphicsEngine/WGETexture.h"
#include "../events/WUpdateTextureSorterEvent.h"
#include "../events/WEventTypes.h"
#include "../WQt4Gui.h"
#include "../WMainWindow.h"
#include "WQtColormapper.h"
#include "WQtColormapper.moc"
...
...
@@ -65,20 +67,25 @@ WQtColormapper::WQtColormapper( QWidget* parent )
m_layout
=
new
QVBoxLayout
();
m_layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
QHBoxLayout
*
buttonLayout
=
new
QHBoxLayout
();
m_downButton
=
new
QPushButton
();
m_downButton
->
setText
(
QString
(
"down"
)
);
m_upButton
=
new
QPushButton
();
m_upButton
->
setText
(
QString
(
"up"
)
);
// create the move-up/down buttons
QAction
*
downAction
=
new
QAction
(
WQt4Gui
::
getMainWindow
()
->
getIconManager
()
->
getIcon
(
"go-down"
),
"Move selected colormap down."
,
this
);
connect
(
downAction
,
SIGNAL
(
triggered
()
),
this
,
SLOT
(
moveItemDown
()
)
);
buttonLayout
->
addWidget
(
m_downButton
);
buttonLayout
->
addWidget
(
m_upButton
);
QAction
*
upAction
=
new
QAction
(
WQt4Gui
::
getMainWindow
()
->
getIconManager
()
->
getIcon
(
"go-up"
),
"Move selected colormap up."
,
this
);
connect
(
upAction
,
SIGNAL
(
triggered
()
),
this
,
SLOT
(
moveItemUp
()
)
);
connect
(
m_upButton
,
SIGNAL
(
pressed
()
),
this
,
SLOT
(
moveItemUp
()
)
);
connect
(
m_downButton
,
SIGNAL
(
pressed
()
),
this
,
SLOT
(
moveItemDown
()
)
);
QAction
*
bottomAction
=
new
QAction
(
WQt4Gui
::
getMainWindow
()
->
getIconManager
()
->
getIcon
(
"go-bottom"
),
"Move selected colormap to the bottom."
,
this
);
connect
(
bottomAction
,
SIGNAL
(
triggered
()
),
this
,
SLOT
(
moveItemBottom
()
)
);
QAction
*
topAction
=
new
QAction
(
WQt4Gui
::
getMainWindow
()
->
getIconManager
()
->
getIcon
(
"go-top"
),
"Move selected colormap to the top."
,
this
);
connect
(
topAction
,
SIGNAL
(
triggered
()
),
this
,
SLOT
(
moveItemTop
()
)
);
addTitleAction
(
bottomAction
);
addTitleAction
(
downAction
);
addTitleAction
(
upAction
);
addTitleAction
(
topAction
);
m_layout
->
addWidget
(
m_textureListWidget
);
m_layout
->
addLayout
(
buttonLayout
);
connect
(
m_textureListWidget
,
SIGNAL
(
itemClicked
(
QListWidgetItem
*
)
),
this
,
SLOT
(
handleTextureClicked
()
)
);
...
...
@@ -206,6 +213,26 @@ void WQtColormapper::moveItemUp()
}
}
void
WQtColormapper
::
moveItemBottom
()
{
boost
::
shared_ptr
<
WGEColormapping
>
cm
=
WGEColormapping
::
instance
();
WQtTextureListItem
*
item
=
dynamic_cast
<
WQtTextureListItem
*
>
(
m_textureListWidget
->
item
(
m_textureListWidget
->
currentIndex
().
row
()
)
);
if
(
item
)
{
cm
->
moveToBottom
(
item
->
getTexture
()
);
}
}
void
WQtColormapper
::
moveItemTop
()
{
boost
::
shared_ptr
<
WGEColormapping
>
cm
=
WGEColormapping
::
instance
();
WQtTextureListItem
*
item
=
dynamic_cast
<
WQtTextureListItem
*
>
(
m_textureListWidget
->
item
(
m_textureListWidget
->
currentIndex
().
row
()
)
);
if
(
item
)
{
cm
->
moveToTop
(
item
->
getTexture
()
);
}
}
void
WQtColormapper
::
selectTexture
(
boost
::
shared_ptr
<
WDataSet
>
dataSet
)
{
// simply check each item against the texture in the specified dataset
...
...
src/qt4gui/controlPanel/WQtColormapper.h
View file @
6de16523
...
...
@@ -95,9 +95,6 @@ private:
QListWidget
*
m_textureListWidget
;
//!< pointer to the tree widget
QVBoxLayout
*
m_layout
;
//!< Layout of the widget
QPushButton
*
m_downButton
;
//!< button down
QPushButton
*
m_upButton
;
//!< button up
/**
* Connection of the WGEColormapping signal "registered" to the member function pushUpdateEvent.
*/
...
...
@@ -183,6 +180,16 @@ private slots:
* change order of items, move currently selected item up
*/
void
moveItemUp
();
/**
* change order of items, move currently selected item to bottom
*/
void
moveItemBottom
();
/**
* change order of items, move currently selected item to top
*/
void
moveItemTop
();
};
#endif // WQTCOLORMAPPER_H
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment