From 2ae58a7e491bcf76dd7da3cc2ecdf52765d84de5 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Mon, 18 Aug 2003 11:26:17 +0000 Subject: cleaning --- src/Screen.cc | 121 +++++++++++++++++----------------------------------------- 1 file changed, 34 insertions(+), 87 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index efe7cb8..04d73af 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.221 2003/08/17 19:06:10 fluxgen Exp $ +// $Id: Screen.cc,v 1.222 2003/08/18 11:26:17 fluxgen Exp $ #include "Screen.hh" @@ -79,23 +79,11 @@ #include #endif // HAVE_CTYPE_H -#ifdef HAVE_DIRENT_H -#include -#endif // HAVE_DIRENT_H - -#ifdef HAVE_LOCALE_H -#include -#endif // HAVE_LOCALE_H - #ifdef HAVE_UNISTD_H #include #include #endif // HAVE_UNISTD_H -#ifdef HAVE_SYS_STAT_H -#include -#endif // HAVE_SYS_STAT_H - #ifdef HAVE_STDARG_H #include #endif // HAVE_STDARG_H @@ -111,10 +99,6 @@ #endif // HAVE_SYS_TIME_H #endif // TIME_WITH_SYS_TIME -#ifndef MAXPATHLEN -#define MAXPATHLEN 255 -#endif // MAXPATHLEN - #include #include #include @@ -433,8 +417,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm, m_configmenu->update(); #ifdef SLIT - // if (slit()) // this will load theme and reconfigure slit - // FbTk::ThemeManager::instance().loadTheme(slit()->theme()); + if (slit()) // this will load theme and reconfigure slit + FbTk::ThemeManager::instance().loadTheme(slit()->theme()); #endif // SLIT FbTk::ThemeManager::instance().load(Fluxbox::instance()->getStyleFilename()); @@ -530,11 +514,9 @@ BScreen::~BScreen() { m_netizen_list.clear(); -#ifdef XINERAMA if (hasXinerama() && m_xinerama_headinfo) { delete [] m_xinerama_headinfo; } -#endif // XINERAMA } unsigned int BScreen::currentWorkspaceID() const { @@ -602,9 +584,6 @@ unsigned int BScreen::maxBottom(int head) const { } void BScreen::reconfigure() { -#ifdef DEBUG - cerr<<__FILE__<<"("<<__LINE__<<"): BScreen::reconfigure"<setAlpha(*resource.menu_alpha); Fluxbox::instance()->loadRootCommand(*this); @@ -865,11 +844,6 @@ void BScreen::changeWorkspaceID(unsigned int id) { if (focused_client) focused = focused_client->fbwindow(); -#ifdef DEBUG - cerr<<__FILE__<<"("<<__FUNCTION__<<"): "<= getCount()"<isIconic() && w->workspaceNumber() == wkspc_id) return; @@ -1660,16 +1630,13 @@ void BScreen::initMenu() { FbTk::RefCount exit_fb(new FbCommands::ExitFluxboxCmd()); FbTk::RefCount execute_xterm(new FbCommands::ExecuteCmd("xterm", screenNumber())); m_rootmenu->setInternalMenu(); - m_rootmenu->insert(i18n->getMessage( - FBNLS::ScreenSet, FBNLS::Screenxterm, + m_rootmenu->insert(i18n->getMessage(FBNLS::ScreenSet, FBNLS::Screenxterm, "xterm"), execute_xterm); - m_rootmenu->insert(i18n->getMessage( - FBNLS::ScreenSet, FBNLS::ScreenRestart, + m_rootmenu->insert(i18n->getMessage(FBNLS::ScreenSet, FBNLS::ScreenRestart, "Restart"), restart_fb); - m_rootmenu->insert(i18n->getMessage( - FBNLS::ScreenSet, FBNLS::ScreenExit, + m_rootmenu->insert(i18n->getMessage(FBNLS::ScreenSet, FBNLS::ScreenExit, "Exit"), exit_fb); } @@ -1727,8 +1694,7 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) { } else if (str_key == "exec") { // exec if (!(str_label.size() && str_cmd.size())) { fprintf(stderr, - i18n->getMessage( - FBNLS::ScreenSet, FBNLS::ScreenEXECError, + i18n->getMessage(FBNLS::ScreenSet, FBNLS::ScreenEXECError, "BScreen::parseMenuFile: [exec] error, " "no menu label and/or command defined\n")); cerr<<"Row: "<getMessage( - FBNLS::ScreenSet, FBNLS::ScreenEXITError, + i18n->getMessage(FBNLS::ScreenSet, FBNLS::ScreenEXITError, "BScreen::parseMenuFile: [exit] error, " "no menu label defined\n")); cerr<<"Row: "< - getMessage( - FBNLS::ScreenSet, FBNLS::ScreenCONFIGError, + getMessage(FBNLS::ScreenSet, FBNLS::ScreenCONFIGError, "BScreen::parseMenufile: [config] error, " "no label defined")); cerr<<"Row: "< - getMessage( - FBNLS::ScreenSet, FBNLS::ScreenINCLUDEError, + getMessage(FBNLS::ScreenSet, FBNLS::ScreenINCLUDEError, "BScreen::parseMenuFile: [include] error, " "no filename defined\n")); cerr<<"Row: "< - getMessage( - FBNLS::ScreenSet, - FBNLS::ScreenINCLUDEErrorReg, - "BScreen::parseMenuFile: [include] error: " - "'%s' is not a regular file\n"), - newfile.c_str()); - - cerr<<"Row: "<saveMenuFilename(newfile.c_str()); - } - } else - perror(newfile.c_str()); + if (!FbTk::Directory::isRegularFile(newfile)) { + fprintf(stderr, + i18n-> + getMessage( + FBNLS::ScreenSet, + FBNLS::ScreenINCLUDEErrorReg, + "BScreen::parseMenuFile: [include] error: " + "'%s' is not a regular file\n"), + newfile.c_str()); + cerr<<"Row: "<saveMenuFilename(newfile.c_str()); + } } } // end of else 'x' } // end of include @@ -2028,7 +1981,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { "AntiAlias"), *resource.antialias, save_and_reconfigure)); - + //!! TODO: antialias FbTk::MenuItem *menu_alpha_item = new IntResMenuItem("Menu Alpha", resource.menu_alpha, 0, 255); menu_alpha_item->setCommand(saverc_cmd); @@ -2046,8 +1999,6 @@ void BScreen::createStyleMenu(FbTk::Menu &menu, // perform shell style ~ home directory expansion string stylesdir(FbTk::StringUtil::expandFilename(directory ? directory : "")); - I18n *i18n = I18n::instance(); - if (!FbTk::Directory::isDirectory(stylesdir)) { //!! TODO: NLS cerr<<"Error creating style menu! Stylesdir: "<()); - int slen = stylesdir.size(); // for each file in directory add filename and path to menu for (size_t file_index = 0; file_index < dir.entries(); file_index++) { std::string style(stylesdir + '/' + filelist[file_index]); - - if (FbTk::Directory::isRegularFile(style)) { - FbTk::MenuItem *item = new StyleMenuItem(filelist[file_index], style); - menu.insert(item); - } + // add to menu only if the file is a regular file + if (FbTk::Directory::isRegularFile(style)) + menu.insert(new StyleMenuItem(filelist[file_index], style)); } // update menu graphics menu.update(); @@ -2104,7 +2052,7 @@ void BScreen::showPosition(int x, int y) { unsigned int head = getCurrHead(); m_geom_window.move(getHeadX(head) + (getHeadWidth(head) - m_geom_window.width()) / 2, - getHeadY(head) + (getHeadHeight(head) - m_geom_window.height()) / 2); + getHeadY(head) + (getHeadHeight(head) - m_geom_window.height()) / 2); } else { m_geom_window.move((width() - m_geom_window.width()) / 2, (height() - m_geom_window.height()) / 2); @@ -2154,13 +2102,12 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) { char label[256]; sprintf(label, - I18n::instance()->getMessage( - FBNLS::ScreenSet, FBNLS::ScreenGeometryFormat, + I18n::instance()->getMessage(FBNLS::ScreenSet, FBNLS::ScreenGeometryFormat, "W: %4d x H: %4d"), gx, gy); m_geom_window.clear(); - //TODO: geom window again?! repeated + //!! TODO: geom window again?! repeated winFrameTheme().font().drawText(m_geom_window.window(), screenNumber(), winFrameTheme().labelTextFocusGC(), -- cgit v0.11.2