aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/fbrun/FbRun.cc6
-rw-r--r--util/fbrun/FbRun.hh2
-rw-r--r--util/fbrun/main.cc6
3 files changed, 14 insertions, 0 deletions
diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc
index b5effd6..5404e69 100644
--- a/util/fbrun/FbRun.cc
+++ b/util/fbrun/FbRun.cc
@@ -62,6 +62,7 @@ FbRun::FbRun(int x, int y, size_t width):
62 m_font("fixed"), 62 m_font("fixed"),
63 m_display(FbTk::App::instance()->display()), 63 m_display(FbTk::App::instance()->display()),
64 m_bevel(4), 64 m_bevel(4),
65 m_padding(0),
65 m_gc(*this), 66 m_gc(*this),
66 m_end(false), 67 m_end(false),
67 m_current_history_item(0), 68 m_current_history_item(0),
@@ -251,6 +252,11 @@ void FbRun::resize(unsigned int width, unsigned int height) {
251 FbTk::TextBox::resize(width, height); 252 FbTk::TextBox::resize(width, height);
252} 253}
253 254
255void FbRun::setPadding(int padding) {
256 m_padding = padding;
257 FbTk::TextBox::setPadding(padding);
258}
259
254void FbRun::redrawLabel() { 260void FbRun::redrawLabel() {
255 clear(); 261 clear();
256} 262}
diff --git a/util/fbrun/FbRun.hh b/util/fbrun/FbRun.hh
index e351d28..dbba415 100644
--- a/util/fbrun/FbRun.hh
+++ b/util/fbrun/FbRun.hh
@@ -43,6 +43,7 @@ public:
43 void resize(unsigned int width, unsigned int height); 43 void resize(unsigned int width, unsigned int height);
44 void setPrint(bool print) { m_print = print; } 44 void setPrint(bool print) { m_print = print; }
45 void setAutocomplete(bool complete) { m_autocomplete = complete; } 45 void setAutocomplete(bool complete) { m_autocomplete = complete; }
46 void setPadding(int padding);
46 47
47 /// load and reconfigure for new font 48 /// load and reconfigure for new font
48 bool loadFont(const std::string &fontname); 49 bool loadFont(const std::string &fontname);
@@ -89,6 +90,7 @@ private:
89 FbTk::Font m_font; ///< font used to draw command text 90 FbTk::Font m_font; ///< font used to draw command text
90 Display *m_display; ///< display connection 91 Display *m_display; ///< display connection
91 int m_bevel; 92 int m_bevel;
93 int m_padding;
92 FbTk::GContext m_gc; ///< graphic context 94 FbTk::GContext m_gc; ///< graphic context
93 bool m_end; ///< marks when this object is done 95 bool m_end; ///< marks when this object is done
94 96
diff --git a/util/fbrun/main.cc b/util/fbrun/main.cc
index 0e52b19..65b8564 100644
--- a/util/fbrun/main.cc
+++ b/util/fbrun/main.cc
@@ -58,6 +58,7 @@ void showUsage(const char *progname) {
58 " -print Print result to stdout"<<endl<< 58 " -print Print result to stdout"<<endl<<
59 " -w [width] Window width in pixels"<<endl<< 59 " -w [width] Window width in pixels"<<endl<<
60 " -h [height] Window height in pixels"<<endl<< 60 " -h [height] Window height in pixels"<<endl<<
61 " -pad [size] Padding size in pixels"<<endl<<
61 " -display [display string] Display name"<<endl<< 62 " -display [display string] Display name"<<endl<<
62 " -pos [x] [y] Window position in pixels"<<endl<< 63 " -pos [x] [y] Window position in pixels"<<endl<<
63 " -nearmouse Window position near mouse"<<endl<< 64 " -nearmouse Window position near mouse"<<endl<<
@@ -76,6 +77,7 @@ int main(int argc, char **argv) {
76 int x = 0, y = 0; // default pos of window 77 int x = 0, y = 0; // default pos of window
77 size_t width = 200, height = 32; // default size of window 78 size_t width = 200, height = 32; // default size of window
78 bool set_height = false, set_width=false; // use height/width of font by default 79 bool set_height = false, set_width=false; // use height/width of font by default
80 int padding = 0; // default horizontal padding for text
79 bool set_pos = false; // set position 81 bool set_pos = false; // set position
80 bool near_mouse = false; // popup near mouse 82 bool near_mouse = false; // popup near mouse
81 bool center = false; 83 bool center = false;
@@ -107,6 +109,8 @@ int main(int argc, char **argv) {
107 } else if (arg == "-h" && i+1 < argc) { 109 } else if (arg == "-h" && i+1 < argc) {
108 height = atoi(argv[++i]); 110 height = atoi(argv[++i]);
109 set_height = true; // mark true else the height of font will be used 111 set_height = true; // mark true else the height of font will be used
112 } else if (arg == "-pad" && i+1 < argc) {
113 padding = atoi(argv[++i]);
110 } else if ((arg == "-display" || arg == "--display") && i+1 < argc) { 114 } else if ((arg == "-display" || arg == "--display") && i+1 < argc) {
111 display_name = argv[++i]; 115 display_name = argv[++i];
112 } else if ((arg == "-pos" || arg == "--pos") && i+2 < argc) { 116 } else if ((arg == "-pos" || arg == "--pos") && i+2 < argc) {
@@ -180,8 +184,10 @@ int main(int argc, char **argv) {
180 cerr<<"FbRun Warning: Failed to load completion file: "<<expanded_filename<<endl; 184 cerr<<"FbRun Warning: Failed to load completion file: "<<expanded_filename<<endl;
181 } 185 }
182 186
187 fbrun.setPadding(padding);
183 fbrun.setTitle(title); 188 fbrun.setTitle(title);
184 fbrun.setText(text); 189 fbrun.setText(text);
190
185 if (preselect) 191 if (preselect)
186 fbrun.selectAll(); 192 fbrun.selectAll();
187 193