cosmetic patch from slava semushin, removes whitespaces and

uses only those things from "namespace std" what we really need.
This commit is contained in:
mathias 2006-10-27 06:57:43 +00:00
parent 34b7f7ddfc
commit 10082d821d
20 changed files with 677 additions and 571 deletions

View file

@ -1,5 +1,12 @@
(Format: Year/Month/Day)
Changes for 1.0rc3:
*06/10/27:
* Cosmetic patch from Slave Semushin
Slit.cc Screen.cc Keys.cc main.cc ToolbarTheme.cc FbTk/MultLayers.cc
FbTk/Transparent.cc FbTk/Resource.cc FbTk/Theme.cc FbTk/XLayer.cc
FbTk/Image.cc FbTk/Color.cc FbTk/FbString.cc Remember.cc RegExp.cc
WinClient.cc Shape.cc ClientPattern.cc FbWinFrame.cc
*06/10/16:
* Added CachedPixmap (Henrik)
FbTk/CachedPixmap.hh/cc

View file

@ -49,8 +49,8 @@
// needed as well for index on some systems (e.g. solaris)
#include <strings.h>
using std::string;
using namespace std;
ClientPattern::ClientPattern():
m_matchlimit(0),
@ -165,7 +165,7 @@ ClientPattern::~ClientPattern() {
}
// return a string representation of this pattern
std::string ClientPattern::toString() const {
string ClientPattern::toString() const {
string pat;
Terms::const_iterator it = m_terms.begin();
Terms::const_iterator it_end = m_terms.end();
@ -225,7 +225,7 @@ bool ClientPattern::match(const WinClient &win) const {
// add an expression to match against
// The first argument is a regular expression, the second is the member
// function that we wish to match against.
bool ClientPattern::addTerm(const std::string &str, WinProperty prop) {
bool ClientPattern::addTerm(const string &str, WinProperty prop) {
Term *term = new Term(str, true);
term->orig = str;
@ -239,7 +239,7 @@ bool ClientPattern::addTerm(const std::string &str, WinProperty prop) {
return true;
}
std::string ClientPattern::getProperty(WinProperty prop, const WinClient &client) const {
string ClientPattern::getProperty(WinProperty prop, const WinClient &client) const {
switch (prop) {
case TITLE:
return client.title();

View file

@ -28,7 +28,10 @@
#include "I18n.hh"
#include <iostream>
using namespace std;
using std::cerr;
using std::endl;
using std::string;
namespace {

View file

@ -40,7 +40,13 @@
#include <locale.h>
#include <iostream>
using namespace std;
using std::string;
#ifdef DEBUG
using std::cerr;
using std::endl;
#endif // DEBUG
namespace FbTk {
@ -54,7 +60,7 @@ static iconv_t *iconv_convs = 0;
static int iconv_convs[CONVSIZE];
#endif // HAVE_ICONV
static std::string locale_codeset;
static string locale_codeset;
/// Initialise all of the iconv conversion descriptors
void init() {
@ -70,9 +76,9 @@ void init() {
locale_codeset = nl_langinfo(CODESET);
#else // openbsd doesnt have this (yet?)
locale_codeset = "";
std::string locale = setlocale(LC_CTYPE, NULL);
string locale = setlocale(LC_CTYPE, NULL);
size_t pos = locale.find('.');
if (pos != std::string::npos)
if (pos != string::npos)
locale_codeset = locale.substr(pos);
#endif // CODESET
@ -125,8 +131,8 @@ void shutdown() {
then you need to set your locale to something UTF-8, OR something
ISO8859-1.
*/
std::string recode(iconv_t cd,
const std::string &in) {
string recode(iconv_t cd,
const string &in) {
// If empty message, yes this can happen, return
if (in.empty())
@ -183,7 +189,7 @@ std::string recode(iconv_t cd,
}
// copy to our return string
std::string ret;
string ret;
ret.append(out, outsize - outbytesleft);
// reset the conversion descriptor
@ -195,27 +201,27 @@ std::string recode(iconv_t cd,
return ret;
}
#else
std::string recode(int cd,
const std::string &str) {
string recode(int cd,
const string &str) {
return str;
}
#endif // HAVE_ICONV
FbString XStrToFb(const std::string &src) {
FbString XStrToFb(const string &src) {
return recode(iconv_convs[X2FB], src);
}
std::string FbStrToX(const FbString &src) {
string FbStrToX(const FbString &src) {
return recode(iconv_convs[FB2X], src);
}
/// Handle thislocale string encodings (strings coming from userspace)
FbString LocaleStrToFb(const std::string &src) {
FbString LocaleStrToFb(const string &src) {
return recode(iconv_convs[LOCALE2FB], src);
}
std::string FbStrToLocale(const FbString &src) {
string FbStrToLocale(const FbString &src) {
return recode(iconv_convs[FB2LOCALE], src);
}
@ -251,9 +257,9 @@ StringConvertor::~StringConvertor() {
#endif
}
bool StringConvertor::setSource(const std::string &encoding) {
bool StringConvertor::setSource(const string &encoding) {
#ifdef HAVE_ICONV
std::string tempenc = encoding;
string tempenc = encoding;
if (encoding == "")
tempenc = FbStringUtil::locale_codeset;
@ -271,7 +277,7 @@ bool StringConvertor::setSource(const std::string &encoding) {
#endif
}
std::string StringConvertor::recode(const std::string &src) {
string StringConvertor::recode(const string &src) {
#ifdef HAVE_ICONV
return FbStringUtil::recode(m_iconv, src);
#else

View file

@ -39,7 +39,10 @@
#include <list>
#include <iostream>
#include <set>
using namespace std;
using std::string;
using std::list;
using std::set;
namespace FbTk {
@ -60,7 +63,7 @@ void Image::init() {
void Image::shutdown() {
std::set<ImageBase*> handlers;
set<ImageBase*> handlers;
// one imagehandler could be registered
// for more than one type
@ -72,8 +75,8 @@ void Image::shutdown() {
}
// free the unique handlers
std::set<ImageBase*>::iterator handler_it = handlers.begin();
std::set<ImageBase*>::iterator handler_it_end = handlers.end();
set<ImageBase*>::iterator handler_it = handlers.begin();
set<ImageBase*>::iterator handler_it_end = handlers.end();
for(; handler_it != handler_it_end; handler_it++) {
delete (*handler_it);
}
@ -81,14 +84,14 @@ void Image::shutdown() {
s_image_map.clear();
}
PixmapWithMask *Image::load(const std::string &filename, int screen_num) {
PixmapWithMask *Image::load(const string &filename, int screen_num) {
if (filename == "")
return false;
// determine file ending
std::string extension(StringUtil::toUpper(StringUtil::findExtension(filename)));
string extension(StringUtil::toUpper(StringUtil::findExtension(filename)));
// valid handle?
if (s_image_map.find(extension) == s_image_map.end())
@ -99,8 +102,8 @@ PixmapWithMask *Image::load(const std::string &filename, int screen_num) {
// failed?, try different search paths
if (pm == 0 && s_search_paths.size()) {
// first we need to get basename of current filename
std::string base_filename = StringUtil::basename(filename);
std::string path = "";
string base_filename = StringUtil::basename(filename);
string path = "";
// append each search path and try to load
StringList::iterator it = s_search_paths.begin();
StringList::iterator it_end = s_search_paths.end();
@ -115,7 +118,7 @@ PixmapWithMask *Image::load(const std::string &filename, int screen_num) {
return pm;
}
bool Image::registerType(const std::string &type, ImageBase &base) {
bool Image::registerType(const string &type, ImageBase &base) {
string ucase_type = StringUtil::toUpper(type);
@ -136,7 +139,7 @@ void Image::remove(ImageBase &base) {
// find and remove all referenses to base
ImageMap::iterator it = s_image_map.begin();
ImageMap::iterator it_end = s_image_map.end();
std::list<std::string> remove_list;
list<string> remove_list;
for (; it != it_end; ++it) {
if (it->second == &base)
remove_list.push_back(it->first);
@ -148,11 +151,11 @@ void Image::remove(ImageBase &base) {
}
}
void Image::addSearchPath(const std::string &search_path) {
void Image::addSearchPath(const string &search_path) {
s_search_paths.push_back(search_path);
}
void Image::removeSearchPath(const std::string &search_path) {
void Image::removeSearchPath(const string &search_path) {
s_search_paths.remove(search_path);
}

View file

@ -28,7 +28,6 @@
#include "App.hh"
#include <iostream>
using namespace std;
using namespace FbTk;

View file

@ -32,7 +32,9 @@
#include <assert.h>
#endif
using namespace std;
using std::cerr;
using std::endl;
using std::string;
namespace FbTk {
@ -149,7 +151,7 @@ bool ResourceManager::save(const char *filename, const char *mergefilename) {
return true;
}
Resource_base *ResourceManager::findResource(const std::string &resname) {
Resource_base *ResourceManager::findResource(const string &resname) {
// find resource name
ResourceList::iterator i = m_resourcelist.begin();
ResourceList::iterator i_end = m_resourcelist.end();
@ -161,7 +163,7 @@ Resource_base *ResourceManager::findResource(const std::string &resname) {
return 0;
}
const Resource_base *ResourceManager::findResource(const std::string &resname) const {
const Resource_base *ResourceManager::findResource(const string &resname) const {
// find resource name
ResourceList::const_iterator i = m_resourcelist.begin();
ResourceList::const_iterator i_end = m_resourcelist.end();
@ -173,7 +175,7 @@ const Resource_base *ResourceManager::findResource(const std::string &resname) c
return 0;
}
string ResourceManager::resourceValue(const std::string &resname) const {
string ResourceManager::resourceValue(const string &resname) const {
const Resource_base *res = findResource(resname);
if (res != 0)
return res->getString();
@ -181,7 +183,7 @@ string ResourceManager::resourceValue(const std::string &resname) const {
return "";
}
void ResourceManager::setResourceValue(const std::string &resname, const std::string &value) {
void ResourceManager::setResourceValue(const string &resname, const string &value) {
Resource_base *res = findResource(resname);
if (res != 0)
res->setFromString(value.c_str());

View file

@ -39,7 +39,9 @@
#include <iostream>
#include <algorithm>
using namespace std;
using std::cerr;
using std::endl;
using std::string;
namespace FbTk {
@ -112,10 +114,10 @@ bool ThemeManager::unregisterTheme(Theme &tm) {
return true;
}
bool ThemeManager::load(const std::string &filename,
const std::string &overlay_filename, int screen_num) {
std::string location = FbTk::StringUtil::expandFilename(filename);
std::string prefix = "";
bool ThemeManager::load(const string &filename,
const string &overlay_filename, int screen_num) {
string location = FbTk::StringUtil::expandFilename(filename);
string prefix = "";
if (FileUtil::isDirectory(filename.c_str())) {
prefix = location;
@ -139,7 +141,7 @@ bool ThemeManager::load(const std::string &filename,
if (!overlay_filename.empty()) {
std::string overlay_location = FbTk::StringUtil::expandFilename(overlay_filename);
string overlay_location = FbTk::StringUtil::expandFilename(overlay_filename);
if (FileUtil::isRegularFile(overlay_location.c_str())) {
XrmDatabaseHelper overlay_db;
if (overlay_db.load(overlay_location.c_str())) {
@ -204,7 +206,7 @@ bool ThemeManager::loadItem(ThemeItem_base &resource) {
}
/// handles resource item loading with specific name/altname
bool ThemeManager::loadItem(ThemeItem_base &resource, const std::string &name, const std::string &alt_name) {
bool ThemeManager::loadItem(ThemeItem_base &resource, const string &name, const string &alt_name) {
XrmValue value;
char *value_type;
if (XrmGetResource(*m_database, name.c_str(),
@ -217,7 +219,7 @@ bool ThemeManager::loadItem(ThemeItem_base &resource, const std::string &name, c
return true;
}
std::string ThemeManager::resourceValue(const std::string &name, const std::string &altname) {
string ThemeManager::resourceValue(const string &name, const string &altname) {
XrmValue value;
char *value_type;
if (*m_database != 0 && XrmGetResource(*m_database, name.c_str(),
@ -232,8 +234,8 @@ void ThemeManager::listItems() {
ThemeList::iterator it = m_themelist.begin();
ThemeList::iterator it_end = m_themelist.end();
for (; it != it_end; ++it) {
std::list<ThemeItem_base *>::iterator item = (*it)->itemList().begin();
std::list<ThemeItem_base *>::iterator item_end = (*it)->itemList().end();
list<ThemeItem_base *>::iterator item = (*it)->itemList().begin();
list<ThemeItem_base *>::iterator item_end = (*it)->itemList().end();
for (; item != item_end; ++item) {
if (typeid(**item) == typeid(ThemeItem<Texture>)) {
@ -249,7 +251,7 @@ void ThemeManager::listItems() {
cerr<<(*item)->name()<<": <boolean>"<<endl;
} else if (typeid(**item) == typeid(ThemeItem<PixmapWithMask>)) {
cerr<<(*item)->name()<<": <filename>"<<endl;
} else if (typeid(**item) == typeid(ThemeItem<std::string>)) {
} else if (typeid(**item) == typeid(ThemeItem<string>)) {
cerr<<(*item)->name()<<": <string>"<<endl;
} else if (typeid(**item) == typeid(ThemeItem<Font>)) {
cerr<<(*item)->name()<<": <font>"<<endl;

View file

@ -35,7 +35,13 @@
#include <iostream>
#include <stdio.h>
using namespace std;
#ifdef HAVE_XRENDER
using std::cerr;
using std::endl;
#endif // HAVE_XRENDER
namespace {
#ifdef HAVE_XRENDER

View file

@ -27,9 +27,15 @@
#include "App.hh"
#include <iostream>
using namespace std;
using std::find;
using namespace FbTk;
#ifdef DEBUG
using std::cerr;
using std::endl;
#endif // DEBUG
XLayer::XLayer(MultLayers &manager, int layernum):
m_manager(manager), m_layernum(layernum) {
}
@ -142,7 +148,7 @@ void XLayer::alignItem(XLayerItem &item) {
// Note: some other things effectively assume that the window list is
// sorted from highest to lowest
// get our item
iterator myit = std::find(itemList().begin(), itemList().end(), &item);
iterator myit = find(itemList().begin(), itemList().end(), &item);
iterator it = myit;
// go to the one above it in our layer (top is front, so we decrement)
@ -220,7 +226,7 @@ void XLayer::stepUp(XLayerItem &item) {
// TODO: is there a better way of doing this?
// get our item
iterator myit = std::find(itemList().begin(), itemList().end(), &item);
iterator myit = find(itemList().begin(), itemList().end(), &item);
iterator it = myit;
// go to the one above it in our layer (top is front, so we decrement)
@ -259,7 +265,7 @@ void XLayer::stepDown(XLayerItem &item) {
return; // nothing to do
// get our position
iterator myit = std::find(itemList().begin(), itemList().end(), &item);
iterator myit = find(itemList().begin(), itemList().end(), &item);
iterator it = myit;
// go one below it (top is front, so we must increment)
@ -283,7 +289,7 @@ void XLayer::raise(XLayerItem &item) {
if (&item == itemList().front())
return; // nothing to do
iterator it = std::find(itemList().begin(), itemList().end(), &item);
iterator it = find(itemList().begin(), itemList().end(), &item);
if (it != itemList().end())
itemList().erase(it);
else {
@ -304,7 +310,7 @@ void XLayer::tempRaise(XLayerItem &item) {
if (&item == itemList().front())
return; // nothing to do
iterator it = std::find(itemList().begin(), itemList().end(), &item);
iterator it = find(itemList().begin(), itemList().end(), &item);
if (it == itemList().end()) {
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<"): WARNING: raise on item not in layer["<<m_layernum<<"]"<<endl;
@ -324,7 +330,7 @@ void XLayer::lower(XLayerItem &item) {
if (&item == itemList().back())
return; // nothing to do
iterator it = std::find(itemList().begin(), itemList().end(), &item);
iterator it = find(itemList().begin(), itemList().end(), &item);
if (it != itemList().end())
// remove this item
itemList().erase(it);
@ -375,7 +381,7 @@ XLayerItem *XLayer::getLowestItem() {
XLayerItem *XLayer::getItemBelow(XLayerItem &item) {
// get our iterator
iterator it = std::find(itemList().begin(), itemList().end(), &item);
iterator it = find(itemList().begin(), itemList().end(), &item);
// go one lower
it++;
@ -389,7 +395,7 @@ XLayerItem *XLayer::getItemBelow(XLayerItem &item) {
XLayerItem *XLayer::getItemAbove(XLayerItem &item) {
// get our iterator
iterator it = std::find(itemList().begin(), itemList().end(), &item);
iterator it = find(itemList().begin(), itemList().end(), &item);
// if this is the beginning (top-most item), do nothing, otherwise give the next one up
// the list (which must be there since we aren't the beginning)

View file

@ -43,7 +43,9 @@
#include <X11/X.h>
#include <iostream>
using namespace std; // mem_fun
using std::mem_fun;
using std::string;
FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl,
FbTk::XLayer &layer,
@ -562,7 +564,7 @@ void FbWinFrame::removeAllButtons() {
}
}
FbWinFrame::ButtonId FbWinFrame::createTab(const std::string &title, FbTk::Command *command,
FbWinFrame::ButtonId FbWinFrame::createTab(const string &title, FbTk::Command *command,
int tabs_padding) {
FbTk::TextButton *button = new FbTk::TextButton(m_tab_container,
theme().font(),

View file

@ -89,7 +89,11 @@
#include <map>
#include <memory>
using namespace std;
using std::cerr;
using std::endl;
using std::string;
using std::vector;
using std::ifstream;
Keys::Keys():
m_display(FbTk::App::instance()->display())
@ -171,7 +175,7 @@ bool Keys::save(const char *filename) const {
// return true;
}
bool Keys::addBinding(const std::string &linebuffer) {
bool Keys::addBinding(const string &linebuffer) {
vector<string> val;
// Parse arguments
@ -187,7 +191,7 @@ bool Keys::addBinding(const std::string &linebuffer) {
unsigned int key = 0, mod = 0;
t_key *current_key=0, *last_key=0;
size_t argc = 0;
std::string keyMode = "default:";
string keyMode = "default:";
if (val[0][val[0].length()-1] == ':') {
argc++;
@ -391,7 +395,7 @@ bool Keys::mergeTree(t_key *newtree, t_key *basetree) {
return false;
}
void Keys::keyMode(std::string keyMode = "default") {
void Keys::keyMode(string keyMode = "default") {
keyspace_t::iterator it = m_map.find(keyMode + ":");
if (it == m_map.end())
m_keylist = m_map["default:"];

View file

@ -33,7 +33,12 @@
#include <string>
#include <iostream>
using namespace std;
using std::string;
#ifdef USE_REGEXP
using std::cerr;
using std::endl;
#endif // USE_REGEXP
/********************************************************
@ -42,7 +47,7 @@ using namespace std;
// full_match is to say if we match on this regexp using the full string
// or just a substring. Substrings aren't supported if not HAVE_REGEXP
RegExp::RegExp(const std::string &str, bool full_match):
RegExp::RegExp(const string &str, bool full_match):
#ifdef USE_REGEXP
m_regex(0) {
string match;
@ -83,7 +88,7 @@ RegExp::~RegExp() {
#endif // USE_REGEXP
}
bool RegExp::match(const std::string &str) const {
bool RegExp::match(const string &str) const {
#ifdef USE_REGEXP
if (m_regex)
return regexec(m_regex, str.c_str(), 0, 0, 0) == 0;

View file

@ -56,7 +56,17 @@
#include <set>
using namespace std;
using std::cerr;
using std::endl;
using std::string;
using std::list;
using std::set;
using std::make_pair;
using std::ifstream;
using std::ofstream;
using std::hex;
using std::dec;
namespace {
@ -254,7 +264,7 @@ Remember::~Remember() {
// the patterns free the "Application"s
// the client mapping shouldn't need cleaning
Patterns::iterator it;
std::set<Application *> all_apps; // no duplicates
set<Application *> all_apps; // no duplicates
while (!m_pats->empty()) {
it = m_pats->begin();
delete it->first; // ClientPattern
@ -262,7 +272,7 @@ Remember::~Remember() {
m_pats->erase(it);
}
std::set<Application *>::iterator ait = all_apps.begin(); // no duplicates
set<Application *>::iterator ait = all_apps.begin(); // no duplicates
for (; ait != all_apps.end(); ++ait) {
delete (*ait);
}
@ -300,7 +310,7 @@ Application * Remember::add(WinClient &winclient) {
return app;
}
int Remember::parseApp(std::ifstream &file, Application &app, std::string *first_line) {
int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
string line;
_FB_USES_NLS;
int row = 0;
@ -523,6 +533,7 @@ void Remember::reconfigure() {
#ifdef DEBUG
cerr<<__FILE__<<"("<<__FUNCTION__<<"): Loading apps file ["<<apps_string<<"]"<<endl;
#endif // DEBUG
ifstream apps_file(apps_string.c_str());
// we merge the old patterns with new ones
@ -536,7 +547,7 @@ void Remember::reconfigure() {
string line;
int row = 0;
bool in_group = false;
std::list<ClientPattern *> grouped_pats;
list<ClientPattern *> grouped_pats;
while (getline(apps_file, line) && ! apps_file.eof()) {
row++;
FbTk::StringUtil::removeFirstWhitespace(line);
@ -578,8 +589,8 @@ void Remember::reconfigure() {
// otherwise assume that it is the start of the attributes
Application *app = 0;
// search for a matching app
std::list<ClientPattern *>::iterator it = grouped_pats.begin();
std::list<ClientPattern *>::iterator it_end = grouped_pats.end();
list<ClientPattern *>::iterator it = grouped_pats.begin();
list<ClientPattern *>::iterator it_end = grouped_pats.end();
while (!app && it != it_end) {
app = findMatchingPatterns(*it, old_pats, true);
++it;
@ -619,7 +630,7 @@ void Remember::reconfigure() {
// patterns themselves, plus the applications!
Patterns::iterator it;
std::set<Application *> old_apps; // no duplicates
set<Application *> old_apps; // no duplicates
while (!old_pats->empty()) {
it = old_pats->begin();
delete it->first; // ClientPattern
@ -640,7 +651,7 @@ void Remember::reconfigure() {
}
}
std::set<Application *>::iterator ait = old_apps.begin(); // no duplicates
set<Application *>::iterator ait = old_apps.begin(); // no duplicates
for (; ait != old_apps.end(); ++ait) {
delete (*ait);
}
@ -667,7 +678,7 @@ void Remember::save() {
Patterns::iterator it = m_pats->begin();
Patterns::iterator it_end = m_pats->end();
std::set<Application *> grouped_apps; // no duplicates
set<Application *> grouped_apps; // no duplicates
for (; it != it_end; ++it) {
Application &a = *it->second;

View file

@ -135,12 +135,25 @@ extern "C" {
#endif // XINERAMA
#include <iostream>
#include <memory>
#include <algorithm>
#include <functional>
#include <stack>
using namespace std;
using std::cerr;
using std::endl;
using std::string;
using std::make_pair;
using std::pair;
using std::list;
using std::vector;
using std::mem_fun;
using std::bind2nd;
using std::equal_to;
#ifdef DEBUG
using std::hex;
using std::dec;
#endif // DEBUG
static bool running = true;
namespace {
@ -245,8 +258,8 @@ getString() const {
BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm,
const std::string &scrname,
const std::string &altscrname):
const string &scrname,
const string &altscrname):
image_dither(rm, false, scrname+".imageDither", altscrname+".ImageDither"),
opaque_move(rm, false, scrname + ".opaqueMove", altscrname+".OpaqueMove"),
full_max(rm, true, scrname+".fullMaximization", altscrname+".FullMaximization"),
@ -295,8 +308,8 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm,
}
BScreen::BScreen(FbTk::ResourceManager &rm,
const std::string &screenname,
const std::string &altscreenname,
const string &screenname,
const string &altscreenname,
int scrn, int num_layers) :
m_clientlist_sig(*this), // client signal
m_iconlist_sig(*this), // icon list signal
@ -726,7 +739,7 @@ void BScreen::update(FbTk::Subject *subj) {
}
FbTk::Menu *BScreen::createMenu(const std::string &label) {
FbTk::Menu *BScreen::createMenu(const string &label) {
FbTk::Menu *menu = new FbMenu(menuTheme(),
imageControl(),
*layerManager().getLayer(Layer::MENU));
@ -735,7 +748,7 @@ FbTk::Menu *BScreen::createMenu(const std::string &label) {
return menu;
}
FbTk::Menu *BScreen::createToggleMenu(const std::string &label) {
FbTk::Menu *BScreen::createToggleMenu(const string &label) {
FbTk::Menu *menu = new ToggleMenu(menuTheme(),
imageControl(),
*layerManager().getLayer(Layer::MENU));
@ -748,7 +761,7 @@ FbTk::Menu *BScreen::createToggleMenu(const std::string &label) {
void BScreen::addExtraWindowMenu(const FbTk::FbString &label, FbTk::Menu *menu) {
menu->setInternalMenu();
menu->disableTitle();
m_extramenus.push_back(std::make_pair(label, menu));
m_extramenus.push_back(make_pair(label, menu));
// recreate window menu
m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));
m_windowmenu->setInternalMenu();
@ -1319,7 +1332,7 @@ bool BScreen::addKdeDockapp(Window client) {
XSelectInput(FbTk::App::instance()->display(), client, StructureNotifyMask);
char intbuff[16];
sprintf(intbuff, "%d", screenNumber());
std::string atom_name("_NET_SYSTEM_TRAY_S");
string atom_name("_NET_SYSTEM_TRAY_S");
atom_name += intbuff; // append number
// find the right atomhandler that has the name: _NET_SYSTEM_TRAY_S<num>
AtomHandler *handler = Fluxbox::instance()->getAtomHandler(atom_name);
@ -1571,7 +1584,7 @@ void BScreen::initMenu() {
void BScreen::addConfigMenu(const FbTk::FbString &label, FbTk::Menu &menu) {
m_configmenu_list.push_back(std::make_pair(label, &menu));
m_configmenu_list.push_back(make_pair(label, &menu));
setupConfigmenu(*m_configmenu.get());
}

View file

@ -28,6 +28,10 @@
#include "FbTk/GContext.hh"
#include "FbTk/FbPixmap.hh"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
#ifdef HAVE_CSTRING
#include <cstring>
#else
@ -35,9 +39,6 @@
#endif
#include <X11/Xutil.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
#ifdef SHAPE
#include <X11/extensions/shape.h>
@ -45,7 +46,8 @@
#include <iostream>
#include <algorithm>
using namespace std;
using std::min;
namespace {

View file

@ -78,7 +78,19 @@
#include <iostream>
#include <algorithm>
using namespace std;
using std::string;
using std::pair;
using std::list;
using std::ifstream;
using std::ofstream;
using std::endl;
#ifdef DEBUG
using std::cerr;
using std::hex;
using std::dec;
#endif // DEBUG
namespace FbTk {
@ -172,7 +184,7 @@ public:
FbTk::MenuItem::setSelected(client.visible());
setToggleItem(true);
}
const std::string &label() const {
const string &label() const {
return m_client.matchName();
}
bool isSelected() const {
@ -216,7 +228,7 @@ public:
void setLabel(const FbTk::FbString &label) {
_FB_USES_NLS;
m_label = (label);
std::string reallabel = m_label + " " +
string reallabel = m_label + " " +
( m_slit.direction() == Slit::HORIZONTAL ?
_FB_XTEXT(Align, Horizontal, "Horizontal", "Horizontal"):
@ -225,7 +237,7 @@ public:
}
private:
Slit &m_slit;
std::string m_label;
string m_label;
};
class PlaceSlitMenuItem: public FbTk::MenuItem {
@ -429,7 +441,7 @@ void Slit::addClient(Window w) {
// Look for slot in client list by name
SlitClient *client = 0;
std::string match_name;
string match_name;
match_name = Xutil::getWMClassName(w);
SlitClients::iterator it = m_client_list.begin();
SlitClients::iterator it_end = m_client_list.end();
@ -1130,15 +1142,15 @@ void Slit::loadClientList(const char *filename) {
// save filename so we can save client list later
m_filename = filename;
std::string real_filename= FbTk::StringUtil::expandFilename(filename);
string real_filename= FbTk::StringUtil::expandFilename(filename);
struct stat buf;
if (stat(real_filename.c_str(), &buf) == 0) {
std::ifstream file(real_filename.c_str());
std::string name;
ifstream file(real_filename.c_str());
string name;
while (! file.eof()) {
name = "";
std::getline(file, name); // get the entire line
getline(file, name); // get the entire line
if (name.empty())
continue;
@ -1193,15 +1205,15 @@ void Slit::updateClientmenu() {
void Slit::saveClientList() {
std::ofstream file(FbTk::StringUtil::expandFilename(m_filename).c_str());
ofstream file(FbTk::StringUtil::expandFilename(m_filename).c_str());
SlitClients::iterator it = m_client_list.begin();
SlitClients::iterator it_end = m_client_list.end();
std::string prevName;
std::string name;
string prevName;
string name;
for (; it != it_end; ++it) {
name = (*it)->matchName();
if (name != prevName)
file << name.c_str() << std::endl;
file << name.c_str() << endl;
prevName = name;
}

View file

@ -26,7 +26,9 @@
#include "FbTk/App.hh"
#include <iostream>
using namespace std;
#include <string>
using std::string;
ToolbarTheme::ToolbarTheme(int screen_num):
FbTk::Theme(screen_num),
@ -48,9 +50,9 @@ ToolbarTheme::~ToolbarTheme() {
}
bool ToolbarTheme::fallback(FbTk::ThemeItem_base &item) {
if (item.name().find(".borderWidth") != std::string::npos) {
if (item.name().find(".borderWidth") != string::npos) {
return FbTk::ThemeManager::instance().loadItem(item, "borderWidth", "BorderWidth");
} else if (item.name().find(".borderColor") != std::string::npos) {
} else if (item.name().find(".borderColor") != string::npos) {
return FbTk::ThemeManager::instance().loadItem(item, "borderColor", "BorderColor");
} else if (item.name() == "toolbar.bevelWidth") {
return FbTk::ThemeManager::instance().loadItem(item, "bevelWidth", "BevelWidth");

View file

@ -44,8 +44,16 @@
#include <assert.h>
#endif
using namespace std;
using std::string;
using std::list;
using std::mem_fun;
#ifdef DEBUG
using std::cerr;
using std::endl;
using std::hex;
using std::dec;
#endif // DEBUG
WinClient::TransientWaitMap WinClient::s_transient_wait;
@ -222,11 +230,11 @@ bool WinClient::getWMIconName(XTextProperty &textprop) const {
return XGetWMName(display(), window(), &textprop);
}
const std::string &WinClient::getWMClassName() const {
const string &WinClient::getWMClassName() const {
return m_instance_name;
}
const std::string &WinClient::getWMClassClass() const {
const string &WinClient::getWMClassClass() const {
return m_class_name;
}
@ -857,7 +865,7 @@ void WinClient::removeTransientFromWaitingList() {
// holds the windows that dont have empty
// transient waiting list
std::list<Window> remove_list;
list<Window> remove_list;
// The worst case complexity is huge, but since we usually do not (virtualy never)
// have a large transient waiting list the time spent here is neglectable
@ -872,8 +880,8 @@ void WinClient::removeTransientFromWaitingList() {
}
// erase empty waiting lists
std::list<Window>::iterator it = remove_list.begin();
std::list<Window>::iterator it_end = remove_list.end();
list<Window>::iterator it = remove_list.begin();
list<Window>::iterator it_end = remove_list.end();
for (; it != it_end; ++it)
s_transient_wait.erase(*it);
}

View file

@ -59,8 +59,21 @@
#include <stdexcept>
#include <typeinfo>
using namespace std;
void showInfo(ostream &ostr) {
using std::cout;
using std::cerr;
using std::endl;
using std::string;
using std::ostream;
using std::ofstream;
using std::streambuf;
using std::auto_ptr;
using std::out_of_range;
using std::runtime_error;
using std::bad_cast;
using std::bad_alloc;
using std::exception;
static void showInfo(ostream &ostr) {
_FB_USES_NLS;
ostr<<_FB_CONSOLETEXT(Common, FluxboxVersion, "Fluxbox version", "Fluxbox version heading")<<": "<<__fluxbox_version<<endl;
@ -177,9 +190,9 @@ void showInfo(ostream &ostr) {
int main(int argc, char **argv) {
std::string session_display = "";
std::string rc_file;
std::string log_filename;
string session_display = "";
string rc_file;
string log_filename;
FbTk::NLSInit("fluxbox.cat");
_FB_USES_NLS;
@ -191,7 +204,7 @@ int main(int argc, char **argv) {
if ((++i) >= argc) {
cerr<<_FB_CONSOLETEXT(main, RCRequiresArg,
"error: '-rc' requires an argument", "the -rc option requires a file argument")<<endl;;
"error: '-rc' requires an argument", "the -rc option requires a file argument")<<endl;
exit(1);
}
@ -208,7 +221,7 @@ int main(int argc, char **argv) {
}
session_display = argv[i];
std::string display_env = "DISPLAY=" + session_display;
string display_env = "DISPLAY=" + session_display;
if (putenv(const_cast<char *>(display_env.c_str()))) {
cerr<<_FB_CONSOLETEXT(main, WarnDisplayEnv,
"warning: couldn't set environment variable 'DISPLAY'",
@ -252,7 +265,7 @@ int main(int argc, char **argv) {
#ifdef __EMX__
_chdir2(getenv("X11ROOT"));
#endif // __EMX__
std::auto_ptr<Fluxbox> fluxbox;
auto_ptr<Fluxbox> fluxbox;
int exitcode=EXIT_FAILURE;
streambuf *outbuf = 0;
@ -279,17 +292,17 @@ int main(int argc, char **argv) {
exitcode = EXIT_SUCCESS;
} catch (std::out_of_range &oor) {
} catch (out_of_range &oor) {
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorOutOfRange, "Out of range", "Error message")<<": "<<oor.what()<<endl;
} catch (std::runtime_error &re) {
} catch (runtime_error &re) {
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorRuntime, "Runtime error", "Error message")<<": "<<re.what()<<endl;
} catch (std::bad_cast &bc) {
} catch (bad_cast &bc) {
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadCast, "Bad cast", "Error message")<<": "<<bc.what()<<endl;
} catch (std::bad_alloc &ba) {
} catch (bad_alloc &ba) {
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadAlloc, "Bad Alloc", "Error message")<<": "<<ba.what()<<endl;
} catch (std::exception &e) {
} catch (exception &e) {
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorStandardException, "Standard Exception", "Error message")<<": "<<e.what()<<endl;
} catch (std::string error_str) {
} catch (string error_str) {
cerr<<_FB_CONSOLETEXT(Common, Error, "Error", "Error message header")<<": "<<error_str<<endl;
} catch (...) {
cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorUnknown, "Unknown error", "Error message")<<"."<<endl;
@ -297,7 +310,7 @@ int main(int argc, char **argv) {
}
bool restarting = false;
std::string restart_argument;
string restart_argument;
if (fluxbox.get()) {
restarting = fluxbox->isRestarting();