fixed set alpha
This commit is contained in:
parent
c9c86f5b84
commit
756dceab76
1 changed files with 14 additions and 18 deletions
32
src/Slit.cc
32
src/Slit.cc
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Slit.cc,v 1.67 2003/06/24 16:29:14 fluxgen Exp $
|
// $Id: Slit.cc,v 1.68 2003/06/24 20:19:36 fluxgen Exp $
|
||||||
|
|
||||||
#include "Slit.hh"
|
#include "Slit.hh"
|
||||||
|
|
||||||
|
@ -1088,6 +1088,9 @@ void Slit::exposeEvent(XExposeEvent &ev) {
|
||||||
// just the are that gets exposed
|
// just the are that gets exposed
|
||||||
frame.window.clearArea(ev.x, ev.y, ev.width, ev.height);
|
frame.window.clearArea(ev.x, ev.y, ev.width, ev.height);
|
||||||
if (m_transp.get()) {
|
if (m_transp.get()) {
|
||||||
|
if ((int)m_transp->alpha() != *m_rc_alpha)
|
||||||
|
m_transp->setAlpha(*m_rc_alpha);
|
||||||
|
|
||||||
if (screen().rootPixmap() != m_transp->source())
|
if (screen().rootPixmap() != m_transp->source())
|
||||||
m_transp->setSource(screen().rootPixmap(), screen().screenNumber());
|
m_transp->setSource(screen().rootPixmap(), screen().screenNumber());
|
||||||
|
|
||||||
|
@ -1101,6 +1104,9 @@ void Slit::exposeEvent(XExposeEvent &ev) {
|
||||||
void Slit::clearWindow() {
|
void Slit::clearWindow() {
|
||||||
frame.window.clear();
|
frame.window.clear();
|
||||||
if (m_transp.get()) {
|
if (m_transp.get()) {
|
||||||
|
if ((int)m_transp->alpha() != *m_rc_alpha)
|
||||||
|
m_transp->setAlpha(*m_rc_alpha);
|
||||||
|
|
||||||
if (screen().rootPixmap() != m_transp->source())
|
if (screen().rootPixmap() != m_transp->source())
|
||||||
m_transp->setSource(screen().rootPixmap(), screen().screenNumber());
|
m_transp->setSource(screen().rootPixmap(), screen().screenNumber());
|
||||||
|
|
||||||
|
@ -1253,24 +1259,14 @@ void Slit::setupMenu() {
|
||||||
FbTk::MenuItem *alpha_menuitem = new IntResMenuItem("Alpha",
|
FbTk::MenuItem *alpha_menuitem = new IntResMenuItem("Alpha",
|
||||||
m_rc_alpha,
|
m_rc_alpha,
|
||||||
0, 255);
|
0, 255);
|
||||||
// helper for setting new alpha value for slit
|
// setup command for alpha value
|
||||||
class SetAlpha:public FbCommands::SaveResources {
|
MacroCommand *alpha_macrocmd = new MacroCommand();
|
||||||
public:
|
RefCount<Command> clear_cmd(new SimpleCommand<Slit>(*this, &Slit::clearWindow));
|
||||||
SetAlpha(Slit &slit, int &alpha):m_slit(slit), m_alpha(alpha) { }
|
alpha_macrocmd->add(saverc_cmd);
|
||||||
void execute() {
|
alpha_macrocmd->add(clear_cmd);
|
||||||
FbCommands::SaveResources::execute();
|
RefCount<Command> set_alpha_cmd(alpha_macrocmd);
|
||||||
if (m_slit.m_transp.get())
|
|
||||||
m_slit.m_transp->setAlpha(m_alpha);
|
|
||||||
else
|
|
||||||
cerr<<"NO TRANSP!"<<endl;
|
|
||||||
m_slit.clearWindow();
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
Slit &m_slit;
|
|
||||||
int &m_alpha;
|
|
||||||
};
|
|
||||||
RefCount<Command> set_alpha_cmd(new SetAlpha(*this, *m_rc_alpha));
|
|
||||||
alpha_menuitem->setCommand(set_alpha_cmd);
|
alpha_menuitem->setCommand(set_alpha_cmd);
|
||||||
|
|
||||||
m_slitmenu.insert(alpha_menuitem);
|
m_slitmenu.insert(alpha_menuitem);
|
||||||
|
|
||||||
m_slitmenu.insert(new SlitDirMenuItem(i18n->getMessage(SlitSet, SlitSlitDirection,
|
m_slitmenu.insert(new SlitDirMenuItem(i18n->getMessage(SlitSet, SlitSlitDirection,
|
||||||
|
|
Loading…
Reference in a new issue