indentation and minor fbtk updates

This commit is contained in:
fluxgen 2002-12-05 00:07:39 +00:00
parent d0f0e2d438
commit 248639a7aa
3 changed files with 298 additions and 352 deletions

View file

@ -19,12 +19,13 @@
// 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: FbRun.cc,v 1.8 2002/11/27 21:56:56 fluxgen Exp $ // $Id: FbRun.cc,v 1.9 2002/12/05 00:07:39 fluxgen Exp $
#include "FbRun.hh" #include "FbRun.hh"
#include "App.hh" #include "App.hh"
#include "EventManager.hh" #include "EventManager.hh"
#include "Color.hh"
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/keysym.h> #include <X11/keysym.h>
@ -37,248 +38,208 @@
using namespace std; using namespace std;
FbRun::FbRun(int x, int y, size_t width): FbRun::FbRun(int x, int y, size_t width):
m_font("fixed"), m_font("fixed"),
m_win(None), m_win((int)0, x, y, //screen num and position
m_display(FbTk::App::instance()->display()), width + m_bevel, m_font.height(), // size
m_bevel(4), KeyPressMask|ExposureMask), // eventmask
m_gc(DefaultGC(m_display, DefaultScreen(m_display))), m_display(FbTk::App::instance()->display()),
m_end(false), m_bevel(4),
m_current_history_item(0) { m_gc(DefaultGC(m_display, DefaultScreen(m_display))),
createWindow(x, y, width + m_bevel, m_font.height()); m_end(false),
m_current_history_item(0) {
// setting nomaximize in local resize
resize(width, m_font.height());
FbTk::EventManager::instance()->registerEventHandler(*this, m_win.window());
} }
FbRun::~FbRun() { FbRun::~FbRun() {
hide(); hide();
FbTk::EventManager::instance()->unregisterEventHandler(m_win); FbTk::EventManager::instance()->unregisterEventHandler(m_win.window());
XDestroyWindow(m_display, m_win);
} }
void FbRun::run(const std::string &command) { void FbRun::run(const std::string &command) {
//fork and execute program //fork and execute program
if (!fork()) { if (!fork()) {
setsid(); setsid();
execl("/bin/sh", "/bin/sh", "-c", command.c_str(), 0); execl("/bin/sh", "/bin/sh", "-c", command.c_str(), 0);
exit(0); //exit fork exit(0); //exit child
} }
hide(); // hide gui hide(); // hide gui
// save command history to file // save command history to file
if (m_runtext.size() != 0) { // no need to save empty command if (m_runtext.size() != 0) { // no need to save empty command
// open file in append mode // open file in append mode
ofstream outfile(m_history_file.c_str(), ios::app); ofstream outfile(m_history_file.c_str(), ios::app);
if (outfile) if (outfile)
outfile<<m_runtext<<endl; outfile<<m_runtext<<endl;
else else
cerr<<"FbRun Warning: Can't write command history to file: "<<m_history_file<<endl; cerr<<"FbRun Warning: Can't write command history to file: "<<m_history_file<<endl;
} }
FbTk::App::instance()->end(); // end application FbTk::App::instance()->end(); // end application
m_end = true; // mark end of processing m_end = true; // mark end of processing
} }
bool FbRun::loadHistory(const char *filename) { bool FbRun::loadHistory(const char *filename) {
if (filename == 0) if (filename == 0)
return false; return false;
ifstream infile(filename); ifstream infile(filename);
if (!infile) { if (!infile) {
//even though we fail to load file, we should try save to it //even though we fail to load file, we should try save to it
m_history_file = filename; m_history_file = filename;
return false; return false;
} }
// clear old history and load new one from file // clear old history and load new one from file
m_history.clear(); m_history.clear();
// each line is a command // each line is a command
string line; string line;
while (!infile.eof()) { while (!infile.eof()) {
getline(infile, line); getline(infile, line);
if (line.size()) // don't add empty lines if (line.size()) // don't add empty lines
m_history.push_back(line); m_history.push_back(line);
} }
// set no current histor to display // set no current histor to display
m_current_history_item = m_history.size(); m_current_history_item = m_history.size();
// set history file // set history file
m_history_file = filename; m_history_file = filename;
return true; return true;
} }
bool FbRun::loadFont(const string &fontname) { bool FbRun::loadFont(const string &fontname) {
if (!m_font.load(fontname.c_str())) if (!m_font.load(fontname.c_str()))
return false; return false;
// resize to fit new font height // resize to fit new font height
resize(m_width, m_font.height() + m_bevel); resize(m_win.width(), m_font.height() + m_bevel);
return true; return true;
} }
void FbRun::setForeground(const XColor &color) { void FbRun::setForeground(const FbTk::Color &color) {
XSetForeground(m_display, m_gc, color.pixel); XSetForeground(m_display, m_gc, color.pixel());
redrawLabel(); redrawLabel();
} }
void FbRun::setBackground(const XColor &color) { void FbRun::setBackground(const FbTk::Color &color) {
XSetWindowBackground(m_display, m_win, color.pixel); m_win.setBackgroundColor(color);
redrawLabel(); redrawLabel();
} }
void FbRun::setText(const string &text) { void FbRun::setText(const string &text) {
m_runtext = text; m_runtext = text;
redrawLabel(); redrawLabel();
} }
void FbRun::setTitle(const string &title) { void FbRun::setTitle(const string &title) {
assert(m_win); m_win.setName(title.c_str());
XStoreName(m_display, m_win, const_cast<char *>(title.c_str()));
} }
void FbRun::move(int x, int y) { void FbRun::move(int x, int y) {
XMoveWindow(m_display, m_win, x, y); m_win.move(x, y);
} }
void FbRun::resize(size_t width, size_t height) { void FbRun::resize(size_t width, size_t height) {
assert(m_win); m_win.resize(width, height);
XResizeWindow(m_display, m_win, width, height); setNoMaximize();
m_width = width;
m_height = height;
setNoMaximize();
} }
void FbRun::show() { void FbRun::show() {
assert(m_win); m_win.show();
XMapWindow(m_display, m_win);
} }
void FbRun::hide() { void FbRun::hide() {
assert(m_win); m_win.hide();
XUnmapWindow(m_display, m_win);
} }
void FbRun::redrawLabel() { void FbRun::redrawLabel() {
assert(m_win); m_win.clear();
drawString(m_bevel/2, m_font.ascent() + m_bevel/2,
XClearWindow(m_display, m_win); m_runtext.c_str(), m_runtext.size());
drawString(m_bevel/2, m_font.ascent() + m_bevel/2,
m_runtext.c_str(), m_runtext.size());
} }
void FbRun::drawString(int x, int y, void FbRun::drawString(int x, int y,
const char *text, size_t len) { const char *text, size_t len) {
assert(m_win); assert(m_gc);
assert(m_gc);
// check right boundary
// and adjust text drawing
size_t text_width = m_font.textWidth(text, len);
size_t startpos = 0;
if (text_width > m_width) {
for (; startpos < len; ++startpos) {
if (m_font.textWidth(text+startpos, len-startpos) < m_width)
break;
}
}
m_font.drawText(m_win, DefaultScreen(m_display), m_gc, text + startpos, len-startpos, x, y); // check right boundary and adjust text drawing
} size_t text_width = m_font.textWidth(text, len);
size_t startpos = 0;
if (text_width > m_win.width()) {
void FbRun::createWindow(int x, int y, size_t width, size_t height) { for (; startpos < len; ++startpos) {
m_win = XCreateSimpleWindow(m_display, // display if (m_font.textWidth(text+startpos, len-startpos) < m_win.width())
DefaultRootWindow(m_display), // parent windows break;
x, y, }
width, height, }
1, // border_width
0, // border
WhitePixel(m_display, DefaultScreen(m_display))); // background
if (m_win == None)
throw string("Failed to create FbRun window!");
XSelectInput(m_display, m_win, KeyPressMask|ExposureMask);
FbTk::EventManager::instance()->registerEventHandler(*this, m_win);
setNoMaximize();
m_width = width;
m_height = height;
m_font.drawText(m_win.window(), DefaultScreen(m_display), m_gc, text + startpos, len-startpos, x, y);
} }
void FbRun::keyPressEvent(XKeyEvent &ke) { void FbRun::keyPressEvent(XKeyEvent &ke) {
KeySym ks; KeySym ks;
char keychar[1]; char keychar[1];
XLookupString(&ke, keychar, 1, &ks, 0); XLookupString(&ke, keychar, 1, &ks, 0);
if (ks == XK_Escape) { if (ks == XK_Escape) {
m_end = true; m_end = true;
hide(); hide();
return; // no more processing FbTk::App::instance()->end(); // end program
} else if (ks == XK_Return) { return; // no more processing
run(m_runtext); } else if (ks == XK_Return) {
m_runtext = ""; // clear text run(m_runtext);
} else if (ks == XK_BackSpace) { m_runtext = ""; // clear text
if (m_runtext.size() != 0) { // we can't erase what we don't have ;) } else if (ks == XK_BackSpace) {
m_runtext.erase(m_runtext.size()-1); if (m_runtext.size() != 0) { // we can't erase what we don't have ;)
redrawLabel(); m_runtext.erase(m_runtext.size()-1);
} redrawLabel();
} else if (! IsModifierKey(ks) && !IsCursorKey(ks)) { }
m_runtext+=keychar[0]; // append character } else if (! IsModifierKey(ks) && !IsCursorKey(ks)) {
redrawLabel(); m_runtext+=keychar[0]; // append character
} else if (IsCursorKey(ks)) { redrawLabel();
} else if (IsCursorKey(ks)) {
switch (ks) { switch (ks) {
case XK_Up: case XK_Up:
prevHistoryItem(); prevHistoryItem();
break; break;
case XK_Down: case XK_Down:
nextHistoryItem(); nextHistoryItem();
break; break;
} }
redrawLabel(); redrawLabel();
} }
} }
void FbRun::exposeEvent(XExposeEvent &ev) { void FbRun::exposeEvent(XExposeEvent &ev) {
redrawLabel(); redrawLabel();
} }
void FbRun::getSize(size_t &width, size_t &height) {
XWindowAttributes attr;
XGetWindowAttributes(m_display, m_win, &attr);
width = attr.width;
height = attr.height;
}
void FbRun::setNoMaximize() { void FbRun::setNoMaximize() {
// we don't need to maximize this window
size_t width, height; XSizeHints sh;
sh.flags = PMaxSize | PMinSize;
getSize(width, height); sh.max_width = m_win.width();
sh.max_height = m_win.height();
// we don't need to maximize this window sh.min_width = m_win.width();
XSizeHints sh; sh.min_height = m_win.height();
sh.flags = PMaxSize | PMinSize; XSetWMNormalHints(m_display, m_win.window(), &sh);
sh.max_width = width;
sh.max_height = height;
sh.min_width = width;
sh.min_height = height;
XSetWMNormalHints(m_display, m_win, &sh);
} }
void FbRun::prevHistoryItem() { void FbRun::prevHistoryItem() {
if (m_current_history_item > 0 && m_history.size() > 0) if (m_current_history_item > 0 && m_history.size() > 0)
m_current_history_item--; m_current_history_item--;
if (m_current_history_item < m_history.size()) if (m_current_history_item < m_history.size())
m_runtext = m_history[m_current_history_item]; m_runtext = m_history[m_current_history_item];
} }
void FbRun::nextHistoryItem() { void FbRun::nextHistoryItem() {
m_current_history_item++; m_current_history_item++;
if (m_current_history_item >= m_history.size()) { if (m_current_history_item >= m_history.size()) {
m_current_history_item = m_history.size(); m_current_history_item = m_history.size();
m_runtext = ""; m_runtext = "";
return; return;
} else } else
m_runtext = m_history[m_current_history_item]; m_runtext = m_history[m_current_history_item];
} }

View file

@ -19,79 +19,79 @@
// 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: FbRun.hh,v 1.7 2002/11/27 21:56:02 fluxgen Exp $ // $Id: FbRun.hh,v 1.8 2002/12/05 00:07:38 fluxgen Exp $
#ifndef FBRUN_HH #ifndef FBRUN_HH
#define FBRUN_HH #define FBRUN_HH
#include "EventHandler.hh" #include "EventHandler.hh"
#include "Font.hh" #include "Font.hh"
#include "FbWindow.hh"
#include <string> #include <string>
#include <vector> #include <vector>
/** /**
Creates and managed a run window Creates and managed a run window
*/ */
class FbRun: public FbTk::EventHandler { class FbRun: public FbTk::EventHandler {
public: public:
FbRun(int x = 0, int y = 0, size_t width = 200); FbRun(int x = 0, int y = 0, size_t width = 200);
~FbRun(); ~FbRun();
void handleEvent(XEvent * const ev); void handleEvent(XEvent * const ev);
void setText(const std::string &text); void setText(const std::string &text);
void setTitle(const std::string &title); void setTitle(const std::string &title);
void move(int x, int y); void move(int x, int y);
void resize(size_t width, size_t height); void resize(size_t width, size_t height);
size_t height() const { return m_height; } size_t height() const { return m_win.height(); }
size_t width() const { return m_width; } size_t width() const { return m_win.width(); }
/// hide window /// hide window
void hide(); void hide();
/// show window /// show window
void show(); void show();
/// load and reconfigure for new font /// load and reconfigure for new font
bool loadFont(const std::string &fontname); bool loadFont(const std::string &fontname);
void setForeground(const XColor &color); void setForeground(const FbTk::Color &color);
void setBackground(const XColor &color); void setBackground(const FbTk::Color &color);
void setAntialias(bool val) { m_font.setAntialias(val); } void setAntialias(bool val) { m_font.setAntialias(val); }
const FbTk::Font &font() const { return m_font; } const FbTk::Font &font() const { return m_font; }
/// execute command and exit /// execute command and exit
void run(const std::string &execstring); void run(const std::string &execstring);
/// is this application done? /// is this application done?
bool end() const { return m_end; } bool end() const { return m_end; }
/** /**
loads history file. loads history file.
@return true on success, else false @return true on success, else false
*/ */
bool loadHistory(const char *filename); bool loadHistory(const char *filename);
/** /**
@name events @name events
*/ */
///@{ ///@{
void exposeEvent(XExposeEvent &ev); void exposeEvent(XExposeEvent &ev);
void keyPressEvent(XKeyEvent &ev); void keyPressEvent(XKeyEvent &ev);
///@} ///@}
private: private:
void nextHistoryItem(); void nextHistoryItem();
void prevHistoryItem(); void prevHistoryItem();
void drawString(int x, int y, const char *text, size_t len); void drawString(int x, int y, const char *text, size_t len);
void getSize(size_t &width, size_t &height); void getSize(size_t &width, size_t &height);
void createWindow(int x, int y, size_t width, size_t height); void createWindow(int x, int y, size_t width, size_t height);
void redrawLabel(); void redrawLabel();
/// set no maximizable for this window /// set no maximizable for this window
void setNoMaximize(); void setNoMaximize();
FbTk::Font m_font; ///< font used to draw command text FbTk::Font m_font; ///< font used to draw command text
Window m_win; ///< toplevel window FbTk::FbWindow m_win; ///< toplevel window
Display *m_display; ///< display connection Display *m_display; ///< display connection
std::string m_runtext; ///< command to execute std::string m_runtext; ///< command to execute
size_t m_width, m_height; ///< size of window int m_bevel; ///< distance to window edge from font in pixels
int m_bevel; ///< distance to window edge from font in pixels GC m_gc; ///< graphic context
GC m_gc; ///< graphic context bool m_end; ///< marks when this object is done
bool m_end; ///< marks when this object is done std::vector<std::string> m_history; ///< history list of commands
std::vector<std::string> m_history; ///< history list of commands size_t m_current_history_item; ///< holds current position in command history
size_t m_current_history_item; ///< holds current position in command history std::string m_history_file; ///< holds filename for command history file
std::string m_history_file; ///< holds filename for command history file
}; };
#endif // FBRUN_HH #endif // FBRUN_HH

View file

@ -19,11 +19,12 @@
// 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: main.cc,v 1.7 2002/11/27 21:54:11 fluxgen Exp $ // $Id: main.cc,v 1.8 2002/12/05 00:07:39 fluxgen Exp $
#include "FbRun.hh" #include "FbRun.hh"
#include "App.hh" #include "App.hh"
#include "StringUtil.hh" #include "StringUtil.hh"
#include "Color.hh"
#include <string> #include <string>
#include <iostream> #include <iostream>
@ -31,134 +32,118 @@
using namespace std; using namespace std;
void showUsage(const char *progname) { void showUsage(const char *progname) {
cerr<<"fbrun 1.1.2 : (c) 2002 Henrik Kinnunen"<<endl; cerr<<"fbrun 1.1.2 : (c) 2002 Henrik Kinnunen"<<endl;
cerr<<"Usage: "<< cerr<<"Usage: "<<
progname<<" [arguments]"<<endl<< progname<<" [arguments]"<<endl<<
"Arguments: "<<endl<< "Arguments: "<<endl<<
" -font [font name] Text font"<<endl<< " -font [font name] Text font"<<endl<<
" -title [title name] Set title"<<endl<< " -title [title name] Set title"<<endl<<
" -text [text] Text input"<<endl<< " -text [text] Text input"<<endl<<
" -w [width] Window width in pixels"<<endl<< " -w [width] Window width in pixels"<<endl<<
" -h [height] Window height in pixels"<<endl<< " -h [height] Window height in pixels"<<endl<<
" -display [display string] Display name"<<endl<< " -display [display string] Display name"<<endl<<
" -pos [x] [y] Window position in pixels"<<endl<< " -pos [x] [y] Window position in pixels"<<endl<<
" -fg [color name] Foreground text color"<<endl<< " -fg [color name] Foreground text color"<<endl<<
" -bg [color name] Background color"<<endl<< " -bg [color name] Background color"<<endl<<
" -a Antialias"<<endl<< " -a Antialias"<<endl<<
" -hf [history file] History file to load (default ~/.fluxbox/history)"<<endl<< " -hf [history file] History file to load (default ~/.fluxbox/fbrun_history)"<<endl<<
" -help Show this help"<<endl<<endl<< " -help Show this help"<<endl<<endl<<
"Example: fbrun -fg black -bg white -text xterm -title \"run xterm\""<<endl; "Example: fbrun -fg black -bg white -text xterm -title \"run xterm\""<<endl;
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
int x = 0, y = 0; // default pos of window int x = 0, y = 0; // default pos of window
size_t width = 200, height = 32; // default size of window size_t width = 200, height = 32; // default size of window
bool set_height = false, set_width=false; // use height/width of font by default bool set_height = false, set_width=false; // use height/width of font by default
bool set_pos = false; // set position bool set_pos = false; // set position
bool antialias = false; // antialias text bool antialias = false; // antialias text
string fontname; // font name string fontname; // font name
string title("Run program"); // default title string title("Run program"); // default title
string text; // default input text string text; // default input text
string foreground("black"); // text color string foreground("black"); // text color
string background("white"); // text background color string background("white"); // text background color
string display_name; // name of the display connection string display_name; // name of the display connection
string history_file("~/.fluxbox/fbrun_history"); // command history file string history_file("~/.fluxbox/fbrun_history"); // command history file
// parse arguments // parse arguments
for (int i=1; i<argc; i++) { for (int i=1; i<argc; i++) {
if (strcmp(argv[i], "-font") == 0 && i+1 < argc) { if (strcmp(argv[i], "-font") == 0 && i+1 < argc) {
fontname = argv[++i]; fontname = argv[++i];
} else if (strcmp(argv[i], "-title") == 0 && i+1 < argc) { } else if (strcmp(argv[i], "-title") == 0 && i+1 < argc) {
title = argv[++i]; title = argv[++i];
} else if (strcmp(argv[i], "-text") == 0 && i+1 < argc) { } else if (strcmp(argv[i], "-text") == 0 && i+1 < argc) {
text = argv[++i]; text = argv[++i];
} else if (strcmp(argv[i], "-w") == 0 && i+1 < argc) { } else if (strcmp(argv[i], "-w") == 0 && i+1 < argc) {
width = atoi(argv[++i]); width = atoi(argv[++i]);
set_width = true; set_width = true;
} else if (strcmp(argv[i], "-h") == 0 && i+1 < argc) { } else if (strcmp(argv[i], "-h") == 0 && i+1 < argc) {
height = atoi(argv[++i]); height = atoi(argv[++i]);
set_height = true; // mark true else the height of font will be used set_height = true; // mark true else the height of font will be used
} else if (strcmp(argv[i], "-display") == 0 && i+1 < argc) { } else if (strcmp(argv[i], "-display") == 0 && i+1 < argc) {
display_name = argv[++i]; display_name = argv[++i];
} else if (strcmp(argv[i], "-pos") == 0 && i+2 < argc) { } else if (strcmp(argv[i], "-pos") == 0 && i+2 < argc) {
x = atoi(argv[++i]); x = atoi(argv[++i]);
y = atoi(argv[++i]); y = atoi(argv[++i]);
set_pos = true; set_pos = true;
} else if (strcmp(argv[i], "-fg") == 0 && i+1 < argc) { } else if (strcmp(argv[i], "-fg") == 0 && i+1 < argc) {
foreground = argv[++i]; foreground = argv[++i];
} else if (strcmp(argv[i], "-bg") == 0 && i+1 < argc) { } else if (strcmp(argv[i], "-bg") == 0 && i+1 < argc) {
background = argv[++i]; background = argv[++i];
} else if (strcmp(argv[i], "-a") == 0) { } else if (strcmp(argv[i], "-a") == 0) {
antialias = true; antialias = true;
} else if (strcmp(argv[i], "-hf") == 0 && i+1 < argc) { } else if (strcmp(argv[i], "-hf") == 0 && i+1 < argc) {
history_file = argv[++i]; history_file = argv[++i];
} else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0) { } else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0) {
showUsage(argv[0]); showUsage(argv[0]);
exit(0); exit(0);
} else { } else {
cerr<<"Invalid argument: "<<argv[i]<<endl; cerr<<"Invalid argument: "<<argv[i]<<endl;
showUsage(argv[0]); showUsage(argv[0]);
exit(0); exit(0);
} }
} }
try { try {
FbTk::App application(display_name.c_str()); FbTk::App application(display_name.c_str());
Display *disp = application.display(); FbRun fbrun;
FbRun fbrun;
if (fontname.size() != 0) { if (fontname.size() != 0) {
if (!fbrun.loadFont(fontname.c_str())) { if (!fbrun.loadFont(fontname.c_str())) {
cerr<<"Failed to load font: "<<fontname<<endl; cerr<<"Failed to load font: "<<fontname<<endl;
cerr<<"Falling back to \"fixed\""<<endl; cerr<<"Falling back to \"fixed\""<<endl;
} }
} }
// get color // get color
XColor xc_foreground, xc_background; XColor xc_foreground, xc_background;
if (XParseColor(disp, DefaultColormap(disp, DefaultScreen(disp)), FbTk::Color fg_color(foreground.c_str(), 0);
foreground.c_str(), FbTk::Color bg_color(background.c_str(), 0);
&xc_foreground) == 0) {
cerr<<"Faild to lookup color: "<<foreground<<endl;
}
if (XParseColor(disp, DefaultColormap(disp, DefaultScreen(disp)),
background.c_str(),
&xc_background) == 0) {
cerr<<"Faild to lookup color: "<<background<<endl;
}
XAllocColor(disp, DefaultColormap(disp, DefaultScreen(disp)),
&xc_foreground);
XAllocColor(disp, DefaultColormap(disp, DefaultScreen(disp)),
&xc_background);
fbrun.setForeground(xc_foreground); fbrun.setForeground(fg_color);
fbrun.setBackground(xc_background); fbrun.setBackground(bg_color);
if (set_height) if (set_height)
fbrun.resize(fbrun.width(), height); fbrun.resize(fbrun.width(), height);
if (set_width) if (set_width)
fbrun.resize(width, fbrun.height()); fbrun.resize(width, fbrun.height());
if (antialias) if (antialias)
fbrun.setAntialias(antialias); fbrun.setAntialias(antialias);
// expand and load command history // expand and load command history
string expanded_filename = StringUtil::expandFilename(history_file); string expanded_filename = StringUtil::expandFilename(history_file);
if (!fbrun.loadHistory(expanded_filename.c_str())) if (!fbrun.loadHistory(expanded_filename.c_str()))
cerr<<"FbRun Warning: Failed to load history file: "<<expanded_filename<<endl; cerr<<"FbRun Warning: Failed to load history file: "<<expanded_filename<<endl;
fbrun.setTitle(title); fbrun.setTitle(title);
fbrun.setText(text); fbrun.setText(text);
fbrun.show(); fbrun.show();
if (set_pos) if (set_pos)
fbrun.move(x, y); fbrun.move(x, y);
application.eventLoop(); application.eventLoop();
} catch (string errstr) { } catch (string errstr) {
cerr<<"Error: "<<errstr<<endl; cerr<<"Error: "<<errstr<<endl;
} }
} }