cleaning
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Button.cc,v 1.16 2003/10/13 23:43:11 fluxgen Exp $ +// $Id: Button.cc,v 1.17 2004/01/08 22:05:12 fluxgen Exp $ #include "Button.hh"@@ -126,8 +126,8 @@ updateTransparent();
// finaly, execute command (this must be done last since this object might be deleted by the command) if (event.button > 0 && event.button <= 5 && - event.x > 0 && event.x < width() && - event.y > 0 && event.y < height() && + event.x > 0 && event.x < static_cast<signed>(width()) && + event.y > 0 && event.y < static_cast<signed>(height()) && m_onclick[event.button -1].get() != 0) m_onclick[event.button - 1]->execute();
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbPixmap.cc,v 1.8 2003/09/10 21:37:05 fluxgen Exp $ +// $Id: FbPixmap.cc,v 1.9 2004/01/08 22:05:34 fluxgen Exp $ #include "FbPixmap.hh" #include "App.hh"@@ -115,7 +115,6 @@ the_copy.depth());
} if (drawable()) { - Display *dpy = FbTk::App::instance()->display(); GContext gc(drawable()); copyArea(the_copy.drawable(),@@ -176,8 +175,8 @@
GContext gc(drawable()); // copy new area - for (int y = 0; y < height(); ++y) { - for (int x = 0; x < width(); ++x) { + for (int y = 0; y < static_cast<signed>(height()); ++y) { + for (int x = 0; x < static_cast<signed>(width()); ++x) { gc.setForeground(XGetPixel(src_image, x, y)); // revers coordinates XDrawPoint(dpy, new_pm.drawable(), gc.gc(), y, x);@@ -219,9 +218,9 @@ float zoom_y = static_cast<float>(height())/static_cast<float>(dest_height);
// start scaling float src_x = 0, src_y = 0; - for (int tx=0; tx<dest_width; ++tx, src_x += zoom_x) { + for (int tx=0; tx < static_cast<signed>(dest_width); ++tx, src_x += zoom_x) { src_y = 0; - for (int ty=0; ty<dest_height; ++ty, src_y += zoom_y) { + for (int ty=0; ty < static_cast<signed>(dest_height); ++ty, src_y += zoom_y) { gc.setForeground(XGetPixel(src_image, static_cast<int>(src_x), static_cast<int>(src_y)));
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbPixmap.hh,v 1.8 2003/12/16 17:06:49 fluxgen Exp $ +// $Id: FbPixmap.hh,v 1.9 2004/01/08 22:05:58 fluxgen Exp $ #ifndef FBTK_FBPIXMAP_HH #define FBTK_FBPIXMAP_HH@@ -70,8 +70,8 @@ void create(Drawable src,
unsigned int width, unsigned int height, int depth); Pixmap m_pm; - int m_depth; unsigned int m_width, m_height; + int m_depth; }; } // end namespace FbTk
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWindow.cc,v 1.29 2003/12/30 17:17:05 fluxgen Exp $ +// $Id: FbWindow.cc,v 1.30 2004/01/08 22:04:39 fluxgen Exp $ #include "FbWindow.hh"@@ -93,8 +93,9 @@ long eventmask,
bool override_redirect, int depth, int class_type): + m_parent(0), m_screen_num(screen_num), - m_parent(0), m_destroy(true), + m_destroy(true), m_buffer_pm(0) { create(RootWindow(FbTk::App::instance()->display(), screen_num),@@ -108,7 +109,8 @@ long eventmask,
bool override_redirect, int depth, int class_type): m_parent(&parent), - m_screen_num(parent.screenNumber()), m_destroy(true), + m_screen_num(parent.screenNumber()), + m_destroy(true), m_buffer_pm(0) { create(parent.window(), x, y, width, height, eventmask,@@ -117,8 +119,9 @@
}; -FbWindow::FbWindow(Window client):m_parent(0), m_window(0), +FbWindow::FbWindow(Window client):m_parent(0), m_screen_num(0), + m_window(0), m_x(0), m_y(0), m_width(1), m_height(1), m_border_width(0),
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.cc,v 1.51 2003/12/18 18:03:23 fluxgen Exp $ +// $Id: Menu.cc,v 1.52 2004/01/08 22:07:00 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE@@ -57,8 +57,8 @@ Menu *Menu::s_focused = 0;
Menu::Menu(MenuTheme &tm, ImageControl &imgctrl): m_theme(tm), - m_image_ctrl(imgctrl), m_parent(0), + m_image_ctrl(imgctrl), m_screen_width(DisplayWidth(FbTk::App::instance()->display(), tm.screenNum())), m_screen_height(DisplayHeight(FbTk::App::instance()->display(), tm.screenNum())), m_alignment(ALIGNDONTCARE),@@ -253,13 +253,13 @@ menu.window.lower();
} void Menu::nextItem() { - if (which_press == menuitems.size() - 1) + if (which_press >= 0 && which_press == static_cast<signed>(menuitems.size() - 1)) return; int old_which_press = which_press; if (old_which_press >= 0 && - old_which_press < menuitems.size() && + old_which_press < static_cast<signed>(menuitems.size()) && menuitems[old_which_press] != 0) { if (menuitems[old_which_press]->submenu()) { // we need to do this explicitly on the menu.window@@ -271,9 +271,9 @@ }
// restore old in case we changed which_press which_press = old_which_press; - if (which_press < 0 || which_press >= menuitems.size()) + if (which_press < 0 || which_press >= static_cast<signed>(menuitems.size())) which_press = 0; - else if (which_press < menuitems.size() - 1) + else if (which_press > 0 && which_press < static_cast<signed>(menuitems.size() - 1)) which_press++;@@ -291,7 +291,7 @@ void Menu::prevItem() {
int old_which_press = which_press; - if (old_which_press >= 0 && old_which_press < menuitems.size()) { + if (old_which_press >= 0 && old_which_press < static_cast<signed>(menuitems.size())) { if (menuitems[old_which_press]->submenu()) { // we need to do this explicitly on the menu.window // since it might hide the parent if we use Menu::hide@@ -302,7 +302,7 @@ }
// restore old in case we changed which_press which_press = old_which_press; - if (which_press < 0 || which_press >= menuitems.size()) + if (which_press < 0 || which_press >= static_cast<signed>(menuitems.size())) which_press = 0; else if (which_press - 1 >= 0) which_press--;@@ -317,7 +317,7 @@
} void Menu::enterSubmenu() { - if (which_press < 0 || which_press >= menuitems.size()) + if (which_press < 0 || which_press >= static_cast<signed>(menuitems.size())) return; Menu *submenu = menuitems[which_press]->submenu();@@ -330,7 +330,7 @@ submenu->nextItem();
} void Menu::enterParent() { - if (which_press < 0 || which_press >= menuitems.size() || parent() == 0) + if (which_press < 0 || which_press >= static_cast<signed>(menuitems.size()) || parent() == 0) return; Menu *submenu = menuitems[which_press]->submenu();@@ -517,7 +517,7 @@ for (unsigned int i = 0; visible && i < menuitems.size(); i++) {
if (i == (unsigned int)which_sub) { drawItem(i, true, true, false); } else - drawItem(i, (i == active_index && isItemEnabled(i)), true, false); + drawItem(i, (static_cast<signed>(i) == active_index && isItemEnabled(i)), true, false); } if (m_parent && visible)@@ -1214,19 +1214,20 @@ // next... figure out how many sublevels over the redraw spans
sbl_d = ((ee.x + ee.width) / menu.item_w), // then we see how many items down to redraw id_d = ((ee.y + ee.height) / menu.item_h); - if (id_d > menu.persub) id_d = menu.persub; + if (static_cast<signed>(id_d) > menu.persub) + id_d = menu.persub; // draw the sublevels and the number of items the exposure spans unsigned int i, ii; for (i = sbl; i <= sbl_d; i++) { // set the iterator to the first item in the sublevel needing redrawing unsigned int index = id + i * menu.persub; - if (index < static_cast<int>(menuitems.size())) { + if (index < menuitems.size()) { Menuitems::iterator it = menuitems.begin() + index; Menuitems::iterator it_end = menuitems.end(); for (ii = id; ii <= id_d && it != it_end; ++it, ii++) { unsigned int index = ii + (i * menu.persub); - drawItem(index, (which_sub == index), true, true, + drawItem(index, (which_sub == static_cast<signed>(index)), true, true, ee.x, ee.y, ee.width, ee.height); } }@@ -1323,7 +1324,7 @@ hide();
break; case XK_Return: // send fake button 1 click - if (which_press >= 0 && which_press < menuitems.size()) { + if (which_press >= 0 && which_press < static_cast<signed>(menuitems.size())) { menuitems[which_press]->click(1, event.time); itemSelected(1, which_press); m_need_update = true;@@ -1372,12 +1373,12 @@ menu.frame.updateTransparent();
} void Menu::openSubmenu() { - if (!isVisible() || which_press < 0 || which_press >= menuitems.size() || - which_sbl < 0 || which_sbl >= menuitems.size()) + if (!isVisible() || which_press < 0 || which_press >= static_cast<signed>(menuitems.size()) || + which_sbl < 0 || which_sbl >= static_cast<signed>(menuitems.size())) return; int item = which_sbl * menu.persub + which_press; - if (item < 0 || item >= menuitems.size()) + if (item < 0 || item >= static_cast<signed>(menuitems.size())) return; drawItem(item, true);
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: MenuTheme.cc,v 1.13 2003/12/17 00:43:22 fluxgen Exp $ +// $Id: MenuTheme.cc,v 1.14 2004/01/08 22:07:58 fluxgen Exp $ #include "MenuTheme.hh"@@ -60,17 +60,16 @@ f_text_gc(RootWindow(m_display, screen_num)),
h_text_gc(RootWindow(m_display, screen_num)), d_text_gc(RootWindow(m_display, screen_num)), hilite_gc(RootWindow(m_display, screen_num)), + m_alpha(255), m_menumode(DELAY_OPEN), m_delayopen(0), // no delay as default - m_delayclose(0), // no delay as default - m_alpha(255) { + m_delayclose(0) // no delay as default +{ // set default values *m_border_width = 0; *m_bevel_width = 0; *m_border_width = 0; - - Window rootwindow = RootWindow(m_display, screen_num); t_text_gc.setForeground(*t_text); f_text_gc.setForeground(*f_text);
@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: MultLayers.cc,v 1.7 2003/07/20 18:05:39 rathnor Exp $ +// $Id: MultLayers.cc,v 1.8 2004/01/08 22:04:04 fluxgen Exp $ #include "MultLayers.hh" #include "XLayer.hh"@@ -48,7 +48,7 @@ }
XLayerItem *MultLayers::getLowestItemAboveLayer(int layernum) { - if (layernum >= m_layers.size() || layernum <= 0) + if (layernum >= static_cast<signed>(m_layers.size()) || layernum <= 0) return 0; layernum--; // next one up@@ -92,7 +92,7 @@
void MultLayers::addToTop(XLayerItem &item, int layernum) { if (layernum < 0) layernum = 0; - else if (layernum >= m_layers.size()) + else if (layernum >= static_cast<signed>(m_layers.size())) layernum = m_layers.size()-1; m_layers[layernum]->insert(item);@@ -103,7 +103,7 @@
// raise the whole layer void MultLayers::raise(XLayer &layer) { int layernum = layer.getLayerNum(); - if (layernum >= (m_layers.size() - 1)) + if (layernum >= static_cast<signed>(m_layers.size() - 1)) // already on top return;@@ -145,7 +145,7 @@
// clamp layer number if (layernum < 0) layernum = 0; - else if (layernum >= m_layers.size()) + else if (layernum >= static_cast<signed>(m_layers.size())) layernum = m_layers.size()-1; // remove item from old layer and insert it into the item.setLayer(*m_layers[layernum]);@@ -158,7 +158,7 @@
int layernum=0, winnum=0, size = this->size(); Window *winlist = new Window[size]; - for (layernum=0; layernum < m_layers.size(); layernum++) { + for (layernum=0; layernum < static_cast<signed>(m_layers.size()); layernum++) { XLayer::ItemList::iterator it = m_layers[layernum]->getItemList().begin(); XLayer::ItemList::iterator it_end = m_layers[layernum]->getItemList().end();@@ -181,7 +181,7 @@ }
int MultLayers::size() { int i = 0, num = 0; - for (; i < m_layers.size(); i++) { + for (; i < static_cast<signed>(m_layers.size()); i++) { num += m_layers[i]->countWindows(); } return num;
@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: MultiButtonMenuItem.cc,v 1.1 2003/11/27 13:20:57 fluxgen Exp $ +// $Id: MultiButtonMenuItem.cc,v 1.2 2004/01/08 22:07:28 fluxgen Exp $ #include "MultiButtonMenuItem.hh"@@ -28,15 +28,15 @@ namespace FbTk {
MultiButtonMenuItem::MultiButtonMenuItem(int buttons, const char *label): MenuItem(label), - m_buttons(buttons), - m_button_exe(0) { + m_button_exe(0), + m_buttons(buttons) { init(buttons); } MultiButtonMenuItem::MultiButtonMenuItem(int buttons, const char *label, Menu *submenu): MenuItem(label, submenu), - m_buttons(buttons), - m_button_exe(0) { + m_button_exe(0), + m_buttons(buttons) { init(buttons); }@@ -46,13 +46,13 @@ delete [] m_button_exe;
} void MultiButtonMenuItem::setCommand(int button, FbTk::RefCount<FbTk::Command> &cmd) { - if (button <= 0 || button > buttons() || buttons() == 0) + if (button <= 0 || button > static_cast<signed>(buttons()) || buttons() == 0) return; m_button_exe[button - 1] = cmd; } void MultiButtonMenuItem::click(int button, int time) { - if (button <= 0 || button > buttons() || buttons() == 0) + if (button <= 0 || button > static_cast<signed>(buttons()) || buttons() == 0) return; if (*m_button_exe[button - 1] != 0)
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: TextBox.cc,v 1.5 2003/12/30 18:26:18 fluxgen Exp $ +// $Id: TextBox.cc,v 1.6 2004/01/08 22:02:52 fluxgen Exp $ #include "TextBox.hh" #include "Font.hh"@@ -140,7 +140,7 @@ adjustStartPos();
} void TextBox::killToEnd() { - if (cursorPosition() < text().size()) { + if (cursorPosition() >= 0 && cursorPosition() < static_cast<signed>(text().size())) { m_text.erase(cursorPosition()); setText(m_text); }@@ -262,7 +262,7 @@
void TextBox::adjustEndPos() { m_end_pos = text().size(); int text_width = font().textWidth(text().c_str() + m_start_pos, m_end_pos - m_start_pos); - while (text_width > width()) { + while (text_width > static_cast<signed>(width())) { m_end_pos--; text_width = font().textWidth(text().c_str() + m_start_pos, m_end_pos - m_start_pos); }@@ -270,12 +270,12 @@ }
void TextBox::adjustStartPos() { int text_width = font().textWidth(text().c_str() + m_start_pos, m_end_pos - m_start_pos); - if (text_width < width()) + if (text_width < static_cast<signed>(width())) return; int start_pos = 0; text_width = font().textWidth(text().c_str() + start_pos, m_end_pos - start_pos); - while (text_width > width()) { + while (text_width > static_cast<signed>(width())) { start_pos++; text_width = font().textWidth(text().c_str() + start_pos, m_end_pos - start_pos); }
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: TextButton.hh,v 1.4 2003/12/16 17:06:52 fluxgen Exp $ +// $Id: TextButton.hh,v 1.5 2004/01/08 22:03:13 fluxgen Exp $ #ifndef FBTK_TEXTBUTTON_HH #define FBTK_TEXTBUTTON_HH@@ -68,11 +68,11 @@ protected:
virtual void drawText(int x_offset = 0, int y_offset = 0); private: - FbTk::FbPixmap m_buffer; ///< for background buffer const FbTk::Font *m_font; std::string m_text; FbTk::Justify m_justify; int m_bevel; + FbTk::FbPixmap m_buffer; ///< for background buffer }; } // end namespace FbTk