|
|
|
@ -71,9 +71,9 @@ public:
|
|
|
|
|
CCrystalTooltip(TQWidget *widget,CrystalClient *vc):TQToolTip(widget),client(vc) {}
|
|
|
|
|
virtual void maybeTip(const TQPoint& p)
|
|
|
|
|
{
|
|
|
|
|
if (client->titlebar_->tqgeometry().contains(p))
|
|
|
|
|
if (client->titlebar_->geometry().contains(p))
|
|
|
|
|
{
|
|
|
|
|
tip(client->titlebar_->tqgeometry(),client->caption());
|
|
|
|
|
tip(client->titlebar_->geometry(),client->caption());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -122,7 +122,7 @@ bool CrystalFactory::reset(unsigned long /*changed*/)
|
|
|
|
|
{
|
|
|
|
|
if (!image_holder)image_holder=new QImageHolder(active.userdefinedPicture,inactive.userdefinedPicture);
|
|
|
|
|
image_holder->setUserdefinedPictures(active.userdefinedPicture,inactive.userdefinedPicture);
|
|
|
|
|
image_holder->tqrepaint(true);
|
|
|
|
|
image_holder->repaint(true);
|
|
|
|
|
}else{
|
|
|
|
|
if (image_holder)delete image_holder;
|
|
|
|
|
image_holder=NULL;
|
|
|
|
@ -762,40 +762,40 @@ void CrystalClient::init()
|
|
|
|
|
// for flicker-free redraws
|
|
|
|
|
widget()->setBackgroundMode(NoBackground);
|
|
|
|
|
|
|
|
|
|
// setup tqlayout
|
|
|
|
|
maintqlayout = new TQGridLayout(widget(), 4, 3); // 4x3 grid
|
|
|
|
|
titletqlayout = new TQHBoxLayout();
|
|
|
|
|
// setup layout
|
|
|
|
|
mainlayout = new TQGridLayout(widget(), 4, 3); // 4x3 grid
|
|
|
|
|
titlelayout = new TQHBoxLayout();
|
|
|
|
|
titlebar_ = new TQSpacerItem(1, ::factory->titlesize-1, TQSizePolicy::Expanding,
|
|
|
|
|
TQSizePolicy::Fixed);
|
|
|
|
|
|
|
|
|
|
maintqlayout->setResizeMode(TQLayout::FreeResize);
|
|
|
|
|
maintqlayout->setRowSpacing(0, (::factory->buttontheme==5)?0:1);
|
|
|
|
|
maintqlayout->setRowSpacing(3, ::factory->borderwidth*1);
|
|
|
|
|
mainlayout->setResizeMode(TQLayout::FreeResize);
|
|
|
|
|
mainlayout->setRowSpacing(0, (::factory->buttontheme==5)?0:1);
|
|
|
|
|
mainlayout->setRowSpacing(3, ::factory->borderwidth*1);
|
|
|
|
|
|
|
|
|
|
maintqlayout->setColSpacing(2,borderSpacing());
|
|
|
|
|
maintqlayout->setColSpacing(0,borderSpacing());
|
|
|
|
|
maintqlayout->addLayout(titletqlayout, 1, 1);
|
|
|
|
|
mainlayout->setColSpacing(2,borderSpacing());
|
|
|
|
|
mainlayout->setColSpacing(0,borderSpacing());
|
|
|
|
|
mainlayout->addLayout(titlelayout, 1, 1);
|
|
|
|
|
|
|
|
|
|
if (isPreview()) {
|
|
|
|
|
char c[512];
|
|
|
|
|
sprintf(c,"<center><b>Crystal %s Preview</b><br>Built: %s</center>",VERSION,__DATE__);
|
|
|
|
|
maintqlayout->addItem(new TQSpacerItem(1, 1,TQSizePolicy::Expanding,TQSizePolicy::Fixed), 0, 1);
|
|
|
|
|
maintqlayout->addItem(new TQSpacerItem(1, ::factory->borderwidth,TQSizePolicy::Expanding,TQSizePolicy::Expanding), 3, 1);
|
|
|
|
|
maintqlayout->addWidget(new TQLabel(i18n(c),widget()), 2, 1);
|
|
|
|
|
mainlayout->addItem(new TQSpacerItem(1, 1,TQSizePolicy::Expanding,TQSizePolicy::Fixed), 0, 1);
|
|
|
|
|
mainlayout->addItem(new TQSpacerItem(1, ::factory->borderwidth,TQSizePolicy::Expanding,TQSizePolicy::Expanding), 3, 1);
|
|
|
|
|
mainlayout->addWidget(new TQLabel(i18n(c),widget()), 2, 1);
|
|
|
|
|
} else {
|
|
|
|
|
maintqlayout->addItem(new TQSpacerItem(0, 0), 2, 1);
|
|
|
|
|
mainlayout->addItem(new TQSpacerItem(0, 0), 2, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
maintqlayout->setRowStretch(2, 10);
|
|
|
|
|
maintqlayout->setColStretch(1, 10);
|
|
|
|
|
mainlayout->setRowStretch(2, 10);
|
|
|
|
|
mainlayout->setColStretch(1, 10);
|
|
|
|
|
|
|
|
|
|
updateMask();
|
|
|
|
|
|
|
|
|
|
for (int n=0; n<ButtonTypeCount; n++) button[n] = 0;
|
|
|
|
|
addButtons(titletqlayout, options()->titleButtonsLeft());
|
|
|
|
|
titletqlayout->addItem(titlebar_);
|
|
|
|
|
addButtons(titlelayout, options()->titleButtonsLeft());
|
|
|
|
|
titlelayout->addItem(titlebar_);
|
|
|
|
|
{
|
|
|
|
|
CrystalButton* lastbutton=addButtons(titletqlayout, options()->titleButtonsRight());
|
|
|
|
|
CrystalButton* lastbutton=addButtons(titlelayout, options()->titleButtonsRight());
|
|
|
|
|
if (lastbutton)lastbutton->setFirstLast(false,true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -873,7 +873,7 @@ bool CrystalClient::isModalSystemNotification()
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CrystalButton* CrystalClient::addButtons(TQBoxLayout *tqlayout, const TQString& s)
|
|
|
|
|
CrystalButton* CrystalClient::addButtons(TQBoxLayout *layout, const TQString& s)
|
|
|
|
|
{
|
|
|
|
|
ButtonImage *bitmap;
|
|
|
|
|
TQString tip;
|
|
|
|
@ -976,15 +976,15 @@ CrystalButton* CrystalClient::addButtons(TQBoxLayout *tqlayout, const TQString&
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '_': // Spacer item
|
|
|
|
|
tqlayout->addSpacing(4);
|
|
|
|
|
layout->addSpacing(4);
|
|
|
|
|
current=NULL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (current)
|
|
|
|
|
{
|
|
|
|
|
tqlayout->addWidget(current);
|
|
|
|
|
if (tqlayout->findWidget(current)==0)current->setFirstLast(true,false);
|
|
|
|
|
layout->addWidget(current);
|
|
|
|
|
if (layout->findWidget(current)==0)current->setFirstLast(true,false);
|
|
|
|
|
}
|
|
|
|
|
lastone=current;
|
|
|
|
|
}
|
|
|
|
@ -1000,7 +1000,7 @@ void CrystalClient::activeChange()
|
|
|
|
|
|
|
|
|
|
void CrystalClient::captionChange()
|
|
|
|
|
{
|
|
|
|
|
if (::factory->drawcaption) widget()->tqrepaint(titlebar_->tqgeometry(), false);
|
|
|
|
|
if (::factory->drawcaption) widget()->repaint(titlebar_->geometry(), false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CrystalClient::desktopChange()
|
|
|
|
@ -1041,17 +1041,17 @@ void CrystalClient::updateLayout()
|
|
|
|
|
{
|
|
|
|
|
if (FullMax)
|
|
|
|
|
{
|
|
|
|
|
maintqlayout->setColSpacing(0,0);
|
|
|
|
|
maintqlayout->setColSpacing(2,0);
|
|
|
|
|
mainlayout->setColSpacing(0,0);
|
|
|
|
|
mainlayout->setColSpacing(2,0);
|
|
|
|
|
}else{
|
|
|
|
|
maintqlayout->setColSpacing(2,borderSpacing());
|
|
|
|
|
maintqlayout->setColSpacing(0,borderSpacing());
|
|
|
|
|
mainlayout->setColSpacing(2,borderSpacing());
|
|
|
|
|
mainlayout->setColSpacing(0,borderSpacing());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
maintqlayout->setRowSpacing(0, (FullMax||::factory->buttontheme==5)?0:1);
|
|
|
|
|
mainlayout->setRowSpacing(0, (FullMax||::factory->buttontheme==5)?0:1);
|
|
|
|
|
for (int i=0;i<ButtonTypeCount;i++)if (button[i])
|
|
|
|
|
button[i]->resetSize(FullMax);
|
|
|
|
|
widget()->tqlayout()->activate();
|
|
|
|
|
widget()->layout()->activate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int CrystalClient::borderSpacing()
|
|
|
|
@ -1095,9 +1095,9 @@ void CrystalClient::resize(const TQSize &size)
|
|
|
|
|
widget()->resize(size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQSize CrystalClient::tqminimumSize() const
|
|
|
|
|
TQSize CrystalClient::minimumSize() const
|
|
|
|
|
{
|
|
|
|
|
return widget()->tqminimumSize();
|
|
|
|
|
return widget()->minimumSize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KDecoration::Position CrystalClient::mousePosition(const TQPoint &point) const
|
|
|
|
@ -1170,34 +1170,34 @@ bool CrystalClient::eventFilter(TQObject *obj, TQEvent *e)
|
|
|
|
|
|
|
|
|
|
void CrystalClient::ClientWindows(Window* v_frame,Window* v_wrapper,Window *v_client)
|
|
|
|
|
{
|
|
|
|
|
Window root=0,frame=0,wrapper=0,client=0,parent=0,*tqchildren=NULL;
|
|
|
|
|
Window root=0,frame=0,wrapper=0,client=0,parent=0,*children=NULL;
|
|
|
|
|
uint numc;
|
|
|
|
|
if (v_frame) *v_frame=0;
|
|
|
|
|
if (v_wrapper) *v_wrapper=0;
|
|
|
|
|
if (v_client) *v_client=0;
|
|
|
|
|
// Our Deco is the child of a frame, get our parent
|
|
|
|
|
if (XQueryTree(qt_xdisplay(),widget()->winId(),&root,&frame,&tqchildren,&numc) == 0)
|
|
|
|
|
if (XQueryTree(qt_xdisplay(),widget()->winId(),&root,&frame,&children,&numc) == 0)
|
|
|
|
|
return;
|
|
|
|
|
if (tqchildren!=NULL)XFree(tqchildren);
|
|
|
|
|
tqchildren=NULL;
|
|
|
|
|
if (children!=NULL)XFree(children);
|
|
|
|
|
children=NULL;
|
|
|
|
|
|
|
|
|
|
// frame has two tqchildren, us and a wrapper, get the wrapper
|
|
|
|
|
if (XQueryTree(qt_xdisplay(),frame,&root,&parent,&tqchildren,&numc)==0)
|
|
|
|
|
// frame has two children, us and a wrapper, get the wrapper
|
|
|
|
|
if (XQueryTree(qt_xdisplay(),frame,&root,&parent,&children,&numc)==0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (uint i=0;i<numc;i++)
|
|
|
|
|
{
|
|
|
|
|
if (tqchildren[i]!=widget()->winId())wrapper=tqchildren[i];
|
|
|
|
|
if (children[i]!=widget()->winId())wrapper=children[i];
|
|
|
|
|
}
|
|
|
|
|
if (tqchildren!=NULL)XFree(tqchildren);
|
|
|
|
|
tqchildren=NULL;
|
|
|
|
|
if (children!=NULL)XFree(children);
|
|
|
|
|
children=NULL;
|
|
|
|
|
|
|
|
|
|
// wrapper has only one child, which is the client. We want this!!
|
|
|
|
|
if (XQueryTree(qt_xdisplay(),wrapper,&root,&parent,&tqchildren,&numc)==0)
|
|
|
|
|
if (XQueryTree(qt_xdisplay(),wrapper,&root,&parent,&children,&numc)==0)
|
|
|
|
|
return;
|
|
|
|
|
if (numc==1)client=tqchildren[0];
|
|
|
|
|
if (tqchildren!=NULL)XFree(tqchildren);
|
|
|
|
|
tqchildren=NULL;
|
|
|
|
|
if (numc==1)client=children[0];
|
|
|
|
|
if (children!=NULL)XFree(children);
|
|
|
|
|
children=NULL;
|
|
|
|
|
if (v_client) *v_client=client;
|
|
|
|
|
if (v_wrapper) *v_wrapper=wrapper;
|
|
|
|
|
if (v_frame) *v_frame=frame;
|
|
|
|
@ -1205,7 +1205,7 @@ void CrystalClient::ClientWindows(Window* v_frame,Window* v_wrapper,Window *v_cl
|
|
|
|
|
|
|
|
|
|
void CrystalClient::mouseDoubleClickEvent(TQMouseEvent *e)
|
|
|
|
|
{
|
|
|
|
|
if (/*(titlebar_->tqgeometry().contains(e->pos()))&&*/(e->button()==Qt::LeftButton)) titlebarDblClickOperation();
|
|
|
|
|
if (/*(titlebar_->geometry().contains(e->pos()))&&*/(e->button()==Qt::LeftButton)) titlebarDblClickOperation();
|
|
|
|
|
else {
|
|
|
|
|
TQMouseEvent me(TQEvent::MouseButtonPress,e->pos(),e->button(),e->state());
|
|
|
|
|
processMousePressEvent(&me);
|
|
|
|
@ -1260,11 +1260,11 @@ void CrystalClient::paintEvent(TQPaintEvent*)
|
|
|
|
|
TQPainter painter(widget());
|
|
|
|
|
|
|
|
|
|
// draw the titlebar
|
|
|
|
|
group = options()->tqcolorGroup(KDecoration::ColorTitleBar, isActive());
|
|
|
|
|
group = options()->colorGroup(KDecoration::ColorTitleBar, isActive());
|
|
|
|
|
WND_CONFIG* wndcfg=(isActive()?&::factory->active:&::factory->inactive);
|
|
|
|
|
|
|
|
|
|
if (::factory->transparency && ::factory->trackdesktop)
|
|
|
|
|
::factory->image_holder->tqrepaint(false); // If other desktop than the last, regrab the root image
|
|
|
|
|
::factory->image_holder->repaint(false); // If other desktop than the last, regrab the root image
|
|
|
|
|
TQPixmap *background=::factory->transparency?::factory->image_holder->image(isActive()):NULL;
|
|
|
|
|
int drawFrame;
|
|
|
|
|
|
|
|
|
@ -1295,7 +1295,7 @@ void CrystalClient::paintEvent(TQPaintEvent*)
|
|
|
|
|
pufferPainter.setFont(options()->font(isActive(), false));
|
|
|
|
|
|
|
|
|
|
TQColor color=options()->color(KDecoration::ColorFont, isActive());
|
|
|
|
|
r=titlebar_->tqgeometry();
|
|
|
|
|
r=titlebar_->geometry();
|
|
|
|
|
r.moveBy(0,-1);
|
|
|
|
|
int logowidth=::factory->logo.width()+::factory->logoDistance;
|
|
|
|
|
if (::factory->logoEnabled!=1 && (isActive()||!::factory->logoActive))
|
|
|
|
@ -1336,7 +1336,7 @@ void CrystalClient::paintEvent(TQPaintEvent*)
|
|
|
|
|
}
|
|
|
|
|
}else if (::factory->logoEnabled!=1 && (isActive()||!::factory->logoActive)) {
|
|
|
|
|
int x=0;
|
|
|
|
|
r=titlebar_->tqgeometry();
|
|
|
|
|
r=titlebar_->geometry();
|
|
|
|
|
if (::factory->logoEnabled==0) x=r.left();
|
|
|
|
|
if (::factory->logoEnabled==2) x=r.right()-::factory->logo.width();
|
|
|
|
|
pufferPainter.drawPixmap(x,(::factory->titlesize-::factory->logo.height())/2,::factory->logo);
|
|
|
|
@ -1485,7 +1485,7 @@ void CrystalClient::resizeEvent(TQResizeEvent *e)
|
|
|
|
|
if (!timer.isActive())timer.start(0,true);
|
|
|
|
|
// Repaint();
|
|
|
|
|
}
|
|
|
|
|
// tqrepaint only every xxx ms
|
|
|
|
|
// repaint only every xxx ms
|
|
|
|
|
else if (::factory->repaintMode==3 || !timer.isActive())
|
|
|
|
|
{
|
|
|
|
|
// Repaint only, when mode!=fade || amount<100
|
|
|
|
@ -1509,7 +1509,7 @@ void CrystalClient::moveEvent(TQMoveEvent *)
|
|
|
|
|
{
|
|
|
|
|
Repaint();
|
|
|
|
|
}
|
|
|
|
|
// tqrepaint every xxx ms, so constant moving does not take too much CPU
|
|
|
|
|
// repaint every xxx ms, so constant moving does not take too much CPU
|
|
|
|
|
else if (::factory->repaintMode==3 || !timer.isActive())
|
|
|
|
|
{
|
|
|
|
|
// Repaint only, when mode!=fade || value<100, because otherwise it is a plain color
|
|
|
|
@ -1528,7 +1528,7 @@ void CrystalClient::showEvent(TQShowEvent *)
|
|
|
|
|
|
|
|
|
|
void CrystalClient::Repaint()
|
|
|
|
|
{
|
|
|
|
|
widget()->tqrepaint(false);
|
|
|
|
|
widget()->repaint(false);
|
|
|
|
|
for (int n=0; n<ButtonTypeCount; n++)
|
|
|
|
|
if (button[n]) button[n]->reset();
|
|
|
|
|
}
|
|
|
|
|