moved StringUtil to FbTk
This commit is contained in:
parent
ae47696324
commit
6e460803e4
3 changed files with 35 additions and 19 deletions
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
//$Id: Keys.cc,v 1.26 2003/04/20 12:21:35 rathnor Exp $
|
//$Id: Keys.cc,v 1.27 2003/04/26 18:27:56 fluxgen Exp $
|
||||||
|
|
||||||
|
|
||||||
#include "Keys.hh"
|
#include "Keys.hh"
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
#include "App.hh"
|
#include "App.hh"
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "../config.h"
|
#include "config.h"
|
||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ bool Keys::load(const char *filename) {
|
||||||
line++;
|
line++;
|
||||||
vector<string> val;
|
vector<string> val;
|
||||||
//Parse arguments
|
//Parse arguments
|
||||||
StringUtil::stringtok(val, linebuffer.c_str());
|
FbTk::StringUtil::stringtok(val, linebuffer.c_str());
|
||||||
|
|
||||||
//must have at least 1 argument
|
//must have at least 1 argument
|
||||||
if (val.size() <= 0)
|
if (val.size() <= 0)
|
||||||
|
@ -297,7 +297,7 @@ bool Keys::load(const char *filename) {
|
||||||
case Keys::EXECUTE:
|
case Keys::EXECUTE:
|
||||||
last_key->execcommand =
|
last_key->execcommand =
|
||||||
const_cast<char *>
|
const_cast<char *>
|
||||||
(StringUtil::strcasestr(linebuffer.c_str(),
|
(FbTk::StringUtil::strcasestr(linebuffer.c_str(),
|
||||||
getActionStr(Keys::EXECUTE))+
|
getActionStr(Keys::EXECUTE))+
|
||||||
strlen(getActionStr(Keys::EXECUTE)));
|
strlen(getActionStr(Keys::EXECUTE)));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -61,12 +61,13 @@ fluxbox_SOURCES = AtomHandler.hh ArrowButton.hh ArrowButton.cc \
|
||||||
Resource.hh Resource.cc \
|
Resource.hh Resource.cc \
|
||||||
RootTheme.hh RootTheme.cc \
|
RootTheme.hh RootTheme.cc \
|
||||||
Screen.cc Screen.hh \
|
Screen.cc Screen.hh \
|
||||||
Slit.cc Slit.hh StringUtil.cc StringUtil.hh \
|
Slit.cc Slit.hh \
|
||||||
TextButton.hh TextButton.cc \
|
TextButton.hh TextButton.cc \
|
||||||
Toolbar.cc Toolbar.hh \
|
Toolbar.cc Toolbar.hh \
|
||||||
ToolbarHandler.cc ToolbarHandler.hh \
|
ToolbarHandler.cc ToolbarHandler.hh \
|
||||||
ToolbarTheme.hh ToolbarTheme.cc \
|
ToolbarTheme.hh ToolbarTheme.cc \
|
||||||
WinButton.hh WinButton.cc Window.cc Window.hh \
|
WinButton.hh WinButton.cc \
|
||||||
|
Window.cc Window.hh \
|
||||||
Workspace.cc Workspace.hh \
|
Workspace.cc Workspace.hh \
|
||||||
XrmDatabaseHelper.hh FbCommands.hh FbCommands.cc LayerMenu.hh \
|
XrmDatabaseHelper.hh FbCommands.hh FbCommands.cc LayerMenu.hh \
|
||||||
IntResMenuItem.hh IntResMenuItem.cc FbMenu.hh \
|
IntResMenuItem.hh IntResMenuItem.cc FbMenu.hh \
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Screen.cc,v 1.137 2003/04/26 15:00:25 fluxgen Exp $
|
// $Id: Screen.cc,v 1.138 2003/04/26 18:27:01 fluxgen Exp $
|
||||||
|
|
||||||
|
|
||||||
#include "Screen.hh"
|
#include "Screen.hh"
|
||||||
|
@ -1352,15 +1352,15 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
} else if ((*dir)[i] == Fluxbox::STICK) {
|
} else if ((*dir)[i] == Fluxbox::STICK) {
|
||||||
WinButton *winbtn = new WinButton(win, WinButton::STICK,
|
WinButton *winbtn = new WinButton(win, WinButton::STICK,
|
||||||
frame.titlebar(),
|
frame.titlebar(),
|
||||||
0, 0, 10, 10);
|
0, 0, 10, 10);
|
||||||
win.stateSig().attach(winbtn);
|
win.stateSig().attach(winbtn);
|
||||||
winbtn->setOnClick(stick_cmd);
|
winbtn->setOnClick(stick_cmd);
|
||||||
newbutton = winbtn;
|
newbutton = winbtn;
|
||||||
} else if ((*dir)[i] == Fluxbox::SHADE) {
|
} else if ((*dir)[i] == Fluxbox::SHADE) {
|
||||||
WinButton *winbtn = new WinButton(win, WinButton::SHADE,
|
WinButton *winbtn = new WinButton(win, WinButton::SHADE,
|
||||||
frame.titlebar(),
|
frame.titlebar(),
|
||||||
0, 0, 10, 10);
|
0, 0, 10, 10);
|
||||||
winbtn->setOnClick(shade_cmd);
|
winbtn->setOnClick(shade_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1754,12 +1754,18 @@ void BScreen::initMenu() {
|
||||||
if (line[0] != '#') {
|
if (line[0] != '#') {
|
||||||
string key;
|
string key;
|
||||||
int pos=0;
|
int pos=0;
|
||||||
int err = StringUtil::getStringBetween(key, line.c_str(), '[', ']');
|
int err = FbTk::StringUtil::
|
||||||
|
getStringBetween(key,
|
||||||
|
line.c_str(),
|
||||||
|
'[', ']');
|
||||||
|
|
||||||
if (key == "begin") {
|
if (key == "begin") {
|
||||||
pos += err;
|
pos += err;
|
||||||
string label;
|
string label;
|
||||||
err = StringUtil::getStringBetween(label, line.c_str()+pos, '(', ')');
|
err = FbTk::StringUtil::
|
||||||
|
getStringBetween(label,
|
||||||
|
line.c_str()+pos,
|
||||||
|
'(', ')');
|
||||||
if (err>0) {
|
if (err>0) {
|
||||||
m_rootmenu->setLabel(label.c_str());
|
m_rootmenu->setLabel(label.c_str());
|
||||||
defaultMenu = parseMenuFile(menu_file, *m_rootmenu.get(), row);
|
defaultMenu = parseMenuFile(menu_file, *m_rootmenu.get(), row);
|
||||||
|
@ -1819,13 +1825,22 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) {
|
||||||
|
|
||||||
std::string str_key, str_label, str_cmd;
|
std::string str_key, str_label, str_cmd;
|
||||||
|
|
||||||
err = StringUtil::getStringBetween(str_key, line.c_str(), '[', ']');
|
err = FbTk::StringUtil::
|
||||||
|
getStringBetween(str_key,
|
||||||
|
line.c_str(),
|
||||||
|
'[', ']');
|
||||||
if (err > 0 ) {
|
if (err > 0 ) {
|
||||||
parse_pos += err;
|
parse_pos += err;
|
||||||
err = StringUtil::getStringBetween(str_label, line.c_str() + parse_pos, '(', ')');
|
err = FbTk::StringUtil::
|
||||||
|
getStringBetween(str_label,
|
||||||
|
line.c_str() + parse_pos,
|
||||||
|
'(', ')');
|
||||||
if (err>0) {
|
if (err>0) {
|
||||||
parse_pos += err;
|
parse_pos += err;
|
||||||
StringUtil::getStringBetween(str_cmd, line.c_str() + parse_pos, '{', '}');
|
FbTk::StringUtil::
|
||||||
|
getStringBetween(str_cmd,
|
||||||
|
line.c_str() + parse_pos,
|
||||||
|
'{', '}');
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
continue; //read next line
|
continue; //read next line
|
||||||
|
@ -1880,7 +1895,7 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) {
|
||||||
// and insert style
|
// and insert style
|
||||||
FbTk::RefCount<FbTk::Command>
|
FbTk::RefCount<FbTk::Command>
|
||||||
setstyle_cmd(new FbCommands::
|
setstyle_cmd(new FbCommands::
|
||||||
SetStyleCmd(StringUtil::
|
SetStyleCmd(FbTk::StringUtil::
|
||||||
expandFilename(str_cmd)));
|
expandFilename(str_cmd)));
|
||||||
menu.insert(str_label.c_str(), setstyle_cmd);
|
menu.insert(str_label.c_str(), setstyle_cmd);
|
||||||
|
|
||||||
|
@ -1913,7 +1928,7 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) {
|
||||||
cerr<<"Row: "<<row<<endl;
|
cerr<<"Row: "<<row<<endl;
|
||||||
} else { // start of else 'x'
|
} else { // start of else 'x'
|
||||||
// perform shell style ~ home directory expansion
|
// perform shell style ~ home directory expansion
|
||||||
string newfile(StringUtil::expandFilename(str_label));
|
string newfile(FbTk::StringUtil::expandFilename(str_label));
|
||||||
|
|
||||||
if (newfile.size() != 0) {
|
if (newfile.size() != 0) {
|
||||||
FILE *submenufile = fopen(newfile.c_str(), "r");
|
FILE *submenufile = fopen(newfile.c_str(), "r");
|
||||||
|
@ -2160,7 +2175,7 @@ void BScreen::createStyleMenu(FbTk::Menu &menu,
|
||||||
const char *label, const char *directory) {
|
const char *label, const char *directory) {
|
||||||
|
|
||||||
// perform shell style ~ home directory expansion
|
// perform shell style ~ home directory expansion
|
||||||
string stylesdir(StringUtil::expandFilename(directory ? directory : ""));
|
string stylesdir(FbTk::StringUtil::expandFilename(directory ? directory : ""));
|
||||||
|
|
||||||
I18n *i18n = I18n::instance();
|
I18n *i18n = I18n::instance();
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
Loading…
Reference in a new issue