tweak winbutton icon drawing, plus a little fix to icon changes

This commit is contained in:
rathnor 2003-10-31 19:32:40 +00:00
parent b88f9b2a9e
commit af7deab379
3 changed files with 26 additions and 12 deletions

View file

@ -1,6 +1,8 @@
(Format: Year/Month/Day)
Changes for 0.9.6:
*03/10/31:
* Tweak some positioning for winbutton drawn icons (Simon)
WinButton.cc
* Fix iconbar button alignment and squash inactive tools (Simon)
- also fix a bunch of rounding issues
-> keep in mind that titlebar/iconbar width may not be exactly

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: IconButton.cc,v 1.9 2003/10/31 10:37:09 rathnor Exp $
// $Id: IconButton.cc,v 1.10 2003/10/31 19:32:39 rathnor Exp $
#include "IconButton.hh"
@ -144,14 +144,14 @@ void IconButton::update(FbTk::Subject *subj) {
if (hints->flags & IconPixmapHint && hints->icon_pixmap != 0) {
// setup icon window
m_icon_window.show();
int new_height = height() - m_icon_window.y();
int new_width = height();
m_icon_window.resize(new_width ? new_width : 1, new_height ? new_height : 1);
int new_height = height() - 2*m_icon_window.y(); // equally padded
int new_width = new_height;
m_icon_window.resize((new_width>0) ? new_width : 1, (new_height>0) ? new_height : 1);
m_icon_pixmap.copy(hints->icon_pixmap);
m_icon_pixmap.scale(m_icon_window.height(), m_icon_window.height());
m_icon_pixmap.scale(m_icon_window.width(), m_icon_window.height());
setBackgroundPixmap(m_icon_pixmap.drawable());
m_icon_window.setBackgroundPixmap(m_icon_pixmap.drawable());
} else {
// no icon pixmap
m_icon_window.move(0, 0);
@ -186,6 +186,8 @@ void IconButton::update(FbTk::Subject *subj) {
void IconButton::setupWindow() {
m_icon_window.clear();
if (!m_win.clientList().empty()) {
setText(m_win.winClient().title());
// draw with x offset and y offset

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/// $Id: WinButton.cc,v 1.15 2003/09/22 12:07:00 rathnor Exp $
/// $Id: WinButton.cc,v 1.16 2003/10/31 19:32:40 rathnor Exp $
#include "WinButton.hh"
#include "App.hh"
@ -50,6 +50,10 @@ void WinButton::buttonReleaseEvent(XButtonEvent &event) {
void WinButton::drawType() {
bool used = false;
// if it's odd and we're centring, we need to add one
int oddW = width()%2;
int oddH = height()%2;
switch (m_type) {
case MAXIMIZE:
@ -177,14 +181,15 @@ void WinButton::drawType() {
if (used)
FbTk::FbWindow::clear();
else if (gc() != 0) {
// width/4 != width/2, so we use /4*2 so that it's properly centred
if (m_listen_to.isStuck()) {
fillRectangle(gc(),
width()/2 - width()/4, height()/2 - height()/4,
width()/2, height()/2);
width()/4*2 + oddW, height()/4*2 + oddH);
} else {
fillRectangle(gc(),
width()/2 - width()/10, height()/2 - height()/10,
width()/5, height()/5);
width()/10*2 + oddW, height()/10*2 + oddH);
}
}
break;
@ -222,10 +227,15 @@ void WinButton::drawType() {
drawLine(gc(),
2, 2,
width() - 3, height() - 3);
width() - 2, height() - 2);
// I can't figure out why this second one needs a y offset of 1?????
// but it does - at least on my box:
// XFree86 Version 4.2.1.1 (Debian 4.2.1-12.1 20031003005825)
// (protocol Version 11, revision 0, vendor release 6600)
drawLine(gc(),
2, width() - 3,
height() - 3, 2);
2, height() - 3,
width() - 2, 1);
}
break;
case SHADE: