summaryrefslogtreecommitdiff
path: root/fluid/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'fluid/widgets')
-rw-r--r--fluid/widgets/App_Menu_Bar.cxx8
-rw-r--r--fluid/widgets/Bin_Button.cxx4
-rw-r--r--fluid/widgets/Code_Editor.cxx23
-rw-r--r--fluid/widgets/Code_Viewer.cxx8
-rw-r--r--fluid/widgets/Formula_Input.cxx27
-rw-r--r--fluid/widgets/Node_Browser.cxx71
-rw-r--r--fluid/widgets/Style_Parser.cxx34
-rw-r--r--fluid/widgets/Text_Viewer.cxx10
8 files changed, 93 insertions, 92 deletions
diff --git a/fluid/widgets/App_Menu_Bar.cxx b/fluid/widgets/App_Menu_Bar.cxx
index 9cb3e2d15..cb0dae33f 100644
--- a/fluid/widgets/App_Menu_Bar.cxx
+++ b/fluid/widgets/App_Menu_Bar.cxx
@@ -23,8 +23,8 @@
#include "Fluid.h"
#include "Project.h"
-using namespace fld;
-using namespace fld::widget;
+
+
extern void mergeback_cb(Fl_Widget *, void *);
@@ -33,7 +33,7 @@ extern void mergeback_cb(Fl_Widget *, void *);
\param[in] X, Y, W, H position and size of the widget
\param[in] L optional label
*/
-App_Menu_Bar::App_Menu_Bar(int X, int Y, int W, int H, const char *L)
+fld::widget::App_Menu_Bar::App_Menu_Bar(int X, int Y, int W, int H, const char *L)
: Fl_Menu_Bar(X, Y, W, H, L)
{
}
@@ -41,7 +41,7 @@ App_Menu_Bar::App_Menu_Bar(int X, int Y, int W, int H, const char *L)
/**
Set menu item visibility and active state before menu pops up.
*/
-int App_Menu_Bar::handle(int event)
+int fld::widget::App_Menu_Bar::handle(int event)
{
Fl_Menu_Item *mi = 0;
if (event == FL_BEFORE_MENU) {
diff --git a/fluid/widgets/Bin_Button.cxx b/fluid/widgets/Bin_Button.cxx
index 728bcc8ed..1a14433e2 100644
--- a/fluid/widgets/Bin_Button.cxx
+++ b/fluid/widgets/Bin_Button.cxx
@@ -24,8 +24,8 @@
#include <FL/Fl_Button.H>
#include <FL/Fl_Window.H>
-using namespace fld;
-using namespace fld::widget;
+
+
/** \class fld::widget::Bin_Button
diff --git a/fluid/widgets/Code_Editor.cxx b/fluid/widgets/Code_Editor.cxx
index 583d07c5b..1551ed3e2 100644
--- a/fluid/widgets/Code_Editor.cxx
+++ b/fluid/widgets/Code_Editor.cxx
@@ -24,8 +24,8 @@
#include <ctype.h>
#include "widgets/Code_Editor.h"
-using namespace fld;
-using namespace fld::widget;
+
+
// ---- Code_Editor implementation
@@ -33,7 +33,7 @@ using namespace fld::widget;
Lookup table for all supported styles.
Every table entry describes a rendering style for the corresponding text.
*/
-Fl_Text_Display::Style_Table_Entry Code_Editor::styletable[] = { // Style table
+Fl_Text_Display::Style_Table_Entry fld::widget::Code_Editor::styletable[] = { // Style table
{ FL_FOREGROUND_COLOR, FL_COURIER, 11 }, // A - Plain
{ FL_DARK_GREEN, FL_COURIER_ITALIC, 11 }, // B - Line comments
{ FL_DARK_GREEN, FL_COURIER_ITALIC, 11 }, // C - Block comments
@@ -51,7 +51,7 @@ Fl_Text_Display::Style_Table_Entry Code_Editor::styletable[] = { // Style tabl
\param[in] in_len byte length to parse
\param[in] in_style starting style letter
*/
-void Code_Editor::style_parse(const char *in_tbuff, // text buffer to parse
+void fld::widget::Code_Editor::style_parse(const char *in_tbuff, // text buffer to parse
char *in_sbuff, // style buffer we modify
int in_len, // byte length to parse
char in_style) { // starting style letter
@@ -104,7 +104,7 @@ void Code_Editor::style_parse(const char *in_tbuff, // text buffer to pa
/**
Update unfinished styles.
*/
-void Code_Editor::style_unfinished_cb(int, void*) {
+void fld::widget::Code_Editor::style_unfinished_cb(int, void*) {
}
/**
@@ -114,7 +114,7 @@ void Code_Editor::style_unfinished_cb(int, void*) {
\param[in] nDeleted number of bytes deleted
\param[in] cbArg pointer back to the code editor
*/
-void Code_Editor::style_update(int pos, int nInserted, int nDeleted,
+void fld::widget::Code_Editor::style_update(int pos, int nInserted, int nDeleted,
int /*nRestyled*/, const char * /*deletedText*/,
void *cbArg) {
Code_Editor *editor = (Code_Editor*)cbArg;
@@ -165,7 +165,7 @@ void Code_Editor::style_update(int pos, int nInserted, int nDeleted,
Find the right indentation depth after pressing the Enter key.
\param[in] e pointer back to the code editor
*/
-int Code_Editor::auto_indent(int, Code_Editor* e) {
+int fld::widget::Code_Editor::auto_indent(int, Code_Editor* e) {
if (e->buffer()->selected()) {
e->insert_position(e->buffer()->primary_selection()->start());
e->buffer()->remove_selection();
@@ -203,7 +203,7 @@ int Code_Editor::auto_indent(int, Code_Editor* e) {
\param[in] X, Y, W, H position and size of the widget
\param[in] L optional label
*/
-Code_Editor::Code_Editor(int X, int Y, int W, int H, const char *L) :
+fld::widget::Code_Editor::Code_Editor(int X, int Y, int W, int H, const char *L) :
Fl_Text_Editor(X, Y, W, H, L) {
buffer(new Fl_Text_Buffer);
@@ -231,7 +231,7 @@ Code_Editor::Code_Editor(int X, int Y, int W, int H, const char *L) :
/**
Destroy a Code_Editor widget.
*/
-Code_Editor::~Code_Editor() {
+fld::widget::Code_Editor::~Code_Editor() {
Fl_Text_Buffer *buf = mStyleBuffer;
mStyleBuffer = 0;
delete buf;
@@ -246,11 +246,12 @@ Code_Editor::~Code_Editor() {
This works by updating the fontsizes in the style table.
\param[in] s the new general height of the text font
*/
-void Code_Editor::textsize(Fl_Fontsize s) {
+void fld::widget::Code_Editor::textsize(Fl_Fontsize s) {
Fl_Text_Editor::textsize(s); // call base class method
// now attempt to update our styletable to honor the new size...
int entries = sizeof(styletable) / sizeof(styletable[0]);
- for(int iter = 0; iter < entries; iter++) {
+ int iter;
+ for (iter = 0; iter < entries; iter++) {
styletable[iter].size = s;
}
} // textsize
diff --git a/fluid/widgets/Code_Viewer.cxx b/fluid/widgets/Code_Viewer.cxx
index fdbfdc626..978ed178e 100644
--- a/fluid/widgets/Code_Viewer.cxx
+++ b/fluid/widgets/Code_Viewer.cxx
@@ -22,15 +22,15 @@
#include "widgets/Code_Viewer.h"
-using namespace fld;
-using namespace fld::widget;
+
+
/**
Create a fld::widget::Code_Viewer widget.
\param[in] X, Y, W, H position and size of the widget
\param[in] L optional label
*/
-Code_Viewer::Code_Viewer(int X, int Y, int W, int H, const char *L)
+fld::widget::Code_Viewer::Code_Viewer(int X, int Y, int W, int H, const char *L)
: Code_Editor(X, Y, W, H, L)
{
default_key_function(kf_ignore);
@@ -41,7 +41,7 @@ Code_Viewer::Code_Viewer(int X, int Y, int W, int H, const char *L)
/**
Tricking Fl_Text_Display into using bearable colors for this specific task.
*/
-void Code_Viewer::draw()
+void fld::widget::Code_Viewer::draw()
{
Fl_Color c = Fl::get_color(FL_SELECTION_COLOR);
Fl::set_color(FL_SELECTION_COLOR, fl_color_average(FL_BACKGROUND_COLOR, FL_FOREGROUND_COLOR, 0.9f));
diff --git a/fluid/widgets/Formula_Input.cxx b/fluid/widgets/Formula_Input.cxx
index 16bc2310a..06f5e3672 100644
--- a/fluid/widgets/Formula_Input.cxx
+++ b/fluid/widgets/Formula_Input.cxx
@@ -23,8 +23,8 @@
#include <ctype.h>
#include <string.h>
-using namespace fld;
-using namespace fld::widget;
+
+
/** \class fld::widget::Formula_Input
The Formula_Input widget is an input field for entering widget coordinates
@@ -36,18 +36,18 @@ using namespace fld::widget;
/**
Create an input field.
*/
-Formula_Input::Formula_Input(int x, int y, int w, int h, const char *l)
+fld::widget::Formula_Input::Formula_Input(int x, int y, int w, int h, const char *l)
: Fl_Input(x, y, w, h, l)
{
Fl_Input::callback((Fl_Callback*)callback_handler_cb);
text("0");
}
-void Formula_Input::callback_handler_cb(Formula_Input *This, void *v) {
+void fld::widget::Formula_Input::callback_handler_cb(Formula_Input *This, void *v) {
This->callback_handler(v);
}
-void Formula_Input::callback_handler(void *v) {
+void fld::widget::Formula_Input::callback_handler(void *v) {
if (user_callback_)
(*user_callback_)(this, v);
// do *not* update the value to show the evaluated formula here, because the
@@ -63,7 +63,7 @@ void Formula_Input::callback_handler(void *v) {
the last character of the variable name when returning.
\return the integer value that was found or calculated
*/
-int Formula_Input::eval_var(uchar *&s) const {
+int fld::widget::Formula_Input::eval_var(uchar *&s) const {
if (!vars_)
return 0;
// find the end of the variable name
@@ -71,7 +71,8 @@ int Formula_Input::eval_var(uchar *&s) const {
while (isalpha(*s)) s++;
int n = (int)(s-v);
// find the variable in the list
- for (Formula_Input_Vars *vars = vars_; vars->name_; vars++) {
+ Formula_Input_Vars *vars;
+ for (vars = vars_; vars->name_; vars++) {
if (strncmp((char*)v, vars->name_, n)==0 && vars->name_[n]==0)
return vars->callback_(this, vars_user_data_);
}
@@ -85,7 +86,7 @@ int Formula_Input::eval_var(uchar *&s) const {
\param prio priority of current operation
\return the value so far
*/
-int Formula_Input::eval(uchar *&s, int prio) const {
+int fld::widget::Formula_Input::eval(uchar *&s, int prio) const {
int v = 0, sgn = 1;
uchar c = *s++;
@@ -157,7 +158,7 @@ int Formula_Input::eval(uchar *&s, int prio) const {
\param s formula as a C string
\return the calculated value
*/
-int Formula_Input::eval(const char *s) const
+int fld::widget::Formula_Input::eval(const char *s) const
{
// duplicate the text, so we can modify it
uchar *buf = (uchar*)fl_strdup(s);
@@ -179,14 +180,14 @@ int Formula_Input::eval(const char *s) const
/**
Evaluate the formula and return the result.
*/
-int Formula_Input::value() const {
+int fld::widget::Formula_Input::value() const {
return eval(text());
}
/**
Set the field to an integer value, replacing previous texts.
*/
-void Formula_Input::value(int v) {
+void fld::widget::Formula_Input::value(int v) {
char buf[32];
fl_snprintf(buf, sizeof(buf), "%d", v);
text(buf);
@@ -195,7 +196,7 @@ void Formula_Input::value(int v) {
/**
Allow vertical mouse dragging and mouse wheel to interactively change the value.
*/
-int Formula_Input::handle(int event) {
+int fld::widget::Formula_Input::handle(int event) {
switch (event) {
case FL_MOUSEWHEEL:
if (Fl::event_dy()) {
@@ -211,7 +212,7 @@ int Formula_Input::handle(int event) {
/** Set the list of the available variables
\param vars array of variables, last entry `has name_` set to `0`
\param user_data is forwarded to the Variable callback */
-void Formula_Input::variables(Formula_Input_Vars *vars, void *user_data) {
+void fld::widget::Formula_Input::variables(Formula_Input_Vars *vars, void *user_data) {
vars_ = vars;
vars_user_data_ = user_data;
}
diff --git a/fluid/widgets/Node_Browser.cxx b/fluid/widgets/Node_Browser.cxx
index 3343d6772..7482298b5 100644
--- a/fluid/widgets/Node_Browser.cxx
+++ b/fluid/widgets/Node_Browser.cxx
@@ -30,8 +30,8 @@
/// Global access to the widget browser.
fld::widget::Node_Browser *widget_browser = 0;
-using namespace fld;
-using namespace fld::widget;
+
+
/**
@@ -49,18 +49,18 @@ using namespace fld::widget;
// ---- static variables
-Fl_Color Node_Browser::label_color = 72;
-Fl_Font Node_Browser::label_font = FL_HELVETICA;
-Fl_Color Node_Browser::class_color = FL_FOREGROUND_COLOR;
-Fl_Font Node_Browser::class_font = FL_HELVETICA_BOLD;
-Fl_Color Node_Browser::func_color = FL_FOREGROUND_COLOR;
-Fl_Font Node_Browser::func_font = FL_HELVETICA;
-Fl_Color Node_Browser::name_color = FL_FOREGROUND_COLOR;
-Fl_Font Node_Browser::name_font = FL_HELVETICA;
-Fl_Color Node_Browser::code_color = FL_FOREGROUND_COLOR;
-Fl_Font Node_Browser::code_font = FL_HELVETICA;
-Fl_Color Node_Browser::comment_color = FL_DARK_GREEN;
-Fl_Font Node_Browser::comment_font = FL_HELVETICA;
+Fl_Color fld::widget::Node_Browser::label_color = 72;
+Fl_Font fld::widget::Node_Browser::label_font = FL_HELVETICA;
+Fl_Color fld::widget::Node_Browser::class_color = FL_FOREGROUND_COLOR;
+Fl_Font fld::widget::Node_Browser::class_font = FL_HELVETICA_BOLD;
+Fl_Color fld::widget::Node_Browser::func_color = FL_FOREGROUND_COLOR;
+Fl_Font fld::widget::Node_Browser::func_font = FL_HELVETICA;
+Fl_Color fld::widget::Node_Browser::name_color = FL_FOREGROUND_COLOR;
+Fl_Font fld::widget::Node_Browser::name_font = FL_HELVETICA;
+Fl_Color fld::widget::Node_Browser::code_color = FL_FOREGROUND_COLOR;
+Fl_Font fld::widget::Node_Browser::code_font = FL_HELVETICA;
+Fl_Color fld::widget::Node_Browser::comment_color = FL_DARK_GREEN;
+Fl_Font fld::widget::Node_Browser::comment_font = FL_HELVETICA;
// ---- global functions
@@ -75,7 +75,7 @@ void redraw_browser() {
Shortcut to create the widget browser.
*/
Fl_Widget *make_widget_browser(int x,int y,int w,int h) {
- return (widget_browser = new Node_Browser(x,y,w,h));
+ return (widget_browser = new fld::widget::Node_Browser(x,y,w,h));
}
/**
@@ -213,7 +213,7 @@ static char *copy_trunc(char *p, const char *str, int maxl, int quote, int trunc
\todo It would be nice to be able to grab one or more nodes and move them
within the hierarchy.
*/
-Node_Browser::Node_Browser(int X,int Y,int W,int H,const char*l) :
+fld::widget::Node_Browser::Node_Browser(int X,int Y,int W,int H,const char*l) :
Fl_Browser_(X,Y,W,H,l)
{
type(FL_MULTI_BROWSER);
@@ -225,7 +225,7 @@ Node_Browser::Node_Browser(int X,int Y,int W,int H,const char*l) :
Override the method to find the first item in the list of elements.
\return the first item
*/
-void *Node_Browser::item_first() const {
+void *fld::widget::Node_Browser::item_first() const {
return Fluid.proj.tree.first;
}
@@ -234,7 +234,7 @@ void *Node_Browser::item_first() const {
\param l this item
\return the next item, irregardless of tree depth, or 0 at the end
*/
-void *Node_Browser::item_next(void *l) const {
+void *fld::widget::Node_Browser::item_next(void *l) const {
return ((Node*)l)->next;
}
@@ -243,7 +243,7 @@ void *Node_Browser::item_next(void *l) const {
\param l this item
\return the previous item, irregardless of tree depth, or 0 at the start
*/
-void *Node_Browser::item_prev(void *l) const {
+void *fld::widget::Node_Browser::item_prev(void *l) const {
return ((Node*)l)->prev;
}
@@ -253,7 +253,7 @@ void *Node_Browser::item_prev(void *l) const {
\return 1 if selected, 0 if not
\todo what is the difference between selected and new_selected, and why do we do this?
*/
-int Node_Browser::item_selected(void *l) const {
+int fld::widget::Node_Browser::item_selected(void *l) const {
return ((Node*)l)->new_selected;
}
@@ -262,7 +262,7 @@ int Node_Browser::item_selected(void *l) const {
\param l this item
\param[in] v 1 if selecting, 0 if not
*/
-void Node_Browser::item_select(void *l,int v) {
+void fld::widget::Node_Browser::item_select(void *l,int v) {
((Node*)l)->new_selected = v;
}
@@ -271,7 +271,7 @@ void Node_Browser::item_select(void *l,int v) {
\param l this item
\return height in FLTK units (used to be pixels before high res screens)
*/
-int Node_Browser::item_height(void *l) const {
+int fld::widget::Node_Browser::item_height(void *l) const {
Node *t = (Node*)l;
if (t->visible) {
if (Fluid.show_comments && t->comment())
@@ -286,7 +286,7 @@ int Node_Browser::item_height(void *l) const {
Override the method to return the estimated height of all items.
\return height in FLTK units
*/
-int Node_Browser::incr_height() const {
+int fld::widget::Node_Browser::incr_height() const {
return textsize() + 5 + linespacing();
}
@@ -311,7 +311,7 @@ int Node_Browser::incr_height() const {
\param X,Y these give the position in window coordinates of the top left
corner of this line
*/
-void Node_Browser::item_draw(void *v, int X, int Y, int, int) const {
+void fld::widget::Node_Browser::item_draw(void *v, int X, int Y, int, int) const {
// cast to a more general type
Node *l = (Node *)v;
@@ -455,7 +455,7 @@ void Node_Browser::item_draw(void *v, int X, int Y, int, int) const {
\param v this item
\return width in FLTK units
*/
-int Node_Browser::item_width(void *v) const {
+int fld::widget::Node_Browser::item_width(void *v) const {
char buf[500]; // edit buffer: large enough to hold 80 UTF-8 chars + nul
@@ -490,7 +490,7 @@ int Node_Browser::item_width(void *v) const {
/**
Callback to tell the Fluid UI when the list of selected items changed.
*/
-void Node_Browser::callback() {
+void fld::widget::Node_Browser::callback() {
selection_changed((Node*)selection());
}
@@ -508,7 +508,7 @@ void Node_Browser::callback() {
\param[in] e the incoming event type
\return 0 if the event is not supported, and 1 if the event was "used up"
*/
-int Node_Browser::handle(int e) {
+int fld::widget::Node_Browser::handle(int e) {
static Node *title;
Node *l;
int X,Y,W,H; bbox(X,Y,W,H);
@@ -549,13 +549,14 @@ int Node_Browser::handle(int e) {
l = pushedtitle;
title = pushedtitle = 0;
if (l) {
+ Node *k;
if (!l->folded_) {
l->folded_ = 1;
- for (Node*k = l->next; k&&k->level>l->level; k = k->next)
+ for (k = l->next; k&&k->level>l->level; k = k->next)
k->visible = 0;
} else {
l->folded_ = 0;
- for (Node*k=l->next; k&&k->level>l->level;) {
+ for (k =l->next; k&&k->level>l->level;) {
k->visible = 1;
if (k->can_have_children() && k->folded_) {
Node *j;
@@ -575,7 +576,7 @@ int Node_Browser::handle(int e) {
/**
Save the current scrollbar position during rebuild.
*/
-void Node_Browser::save_scroll_position() {
+void fld::widget::Node_Browser::save_scroll_position() {
saved_h_scroll_ = hposition();
saved_v_scroll_ = vposition();
}
@@ -583,7 +584,7 @@ void Node_Browser::save_scroll_position() {
/**
Restore the previous scrollbar position after rebuild.
*/
-void Node_Browser::restore_scroll_position() {
+void fld::widget::Node_Browser::restore_scroll_position() {
hposition(saved_h_scroll_);
vposition(saved_v_scroll_);
}
@@ -593,7 +594,7 @@ void Node_Browser::restore_scroll_position() {
This clears internal caches, recalculates the scroll bar sizes, and
sends a redraw() request to the widget.
*/
-void Node_Browser::rebuild() {
+void fld::widget::Node_Browser::rebuild() {
save_scroll_position();
new_list();
damage(FL_DAMAGE_SCROLL);
@@ -605,7 +606,7 @@ void Node_Browser::rebuild() {
Rebuild the browser layout and make sure that the given item is visible.
\param[in] inNode pointer to a widget node derived from Node.
*/
-void Node_Browser::display(Node *inNode) {
+void fld::widget::Node_Browser::display(Node *inNode) {
if (!inNode) {
// Alternative: find the first (last?) visible selected item.
return;
@@ -639,7 +640,7 @@ void Node_Browser::display(Node *inNode) {
vposition(newV);
}
-void Node_Browser::load_prefs() {
+void fld::widget::Node_Browser::load_prefs() {
int c;
Fl_Preferences p(Fluid.preferences, "widget_browser");
p.get("label_color", c, 72); label_color = c;
@@ -656,7 +657,7 @@ void Node_Browser::load_prefs() {
p.get("comment_font", c, FL_HELVETICA); comment_font = c;
}
-void Node_Browser::save_prefs() {
+void fld::widget::Node_Browser::save_prefs() {
Fl_Preferences p(Fluid.preferences, "widget_browser");
p.set("label_color", (int)label_color);
p.set("label_font", (int)label_font);
diff --git a/fluid/widgets/Style_Parser.cxx b/fluid/widgets/Style_Parser.cxx
index 9929cc01a..9188e565e 100644
--- a/fluid/widgets/Style_Parser.cxx
+++ b/fluid/widgets/Style_Parser.cxx
@@ -22,9 +22,6 @@
#include <ctype.h>
#include <stdlib.h> // bsearch()
-using namespace fld;
-using namespace fld::widget;
-
// Sorted list of C/C++ keywords...
static const char * const code_keywords[] = {
"and",
@@ -133,7 +130,7 @@ static void* search_types(char *find) {
// Applies the current style, advances to next text + style char.
// Returns 0 if hit end of buffer, 1 otherwise.
//
-int Style_Parser::parse_over_char(int handle_crlf) {
+int fld::widget::Style_Parser::parse_over_char(int handle_crlf) {
char c = *tbuff;
// End of line?
@@ -160,7 +157,7 @@ int Style_Parser::parse_over_char(int handle_crlf) {
// Parse over white space using current style
// Returns 0 if hit end of buffer, 1 otherwise.
//
-int Style_Parser::parse_over_white() {
+int fld::widget::Style_Parser::parse_over_white() {
while ( len > 0 && strchr(" \t", *tbuff))
{ if ( !parse_over_char() ) return 0; }
return 1;
@@ -169,7 +166,7 @@ int Style_Parser::parse_over_white() {
// Parse over non-white alphabetic text
// Returns 0 if hit end of buffer, 1 otherwise.
//
-int Style_Parser::parse_over_alpha() {
+int fld::widget::Style_Parser::parse_over_alpha() {
while ( len > 0 && isalpha(*tbuff) )
{ if ( !parse_over_char() ) return 0; }
return 1;
@@ -178,7 +175,7 @@ int Style_Parser::parse_over_alpha() {
// Parse to end of line in specified style.
// Returns 0 if hit end of buffer, 1 otherwise.
//
-int Style_Parser::parse_to_eol(char s) {
+int fld::widget::Style_Parser::parse_to_eol(char s) {
char save = style;
style = s;
while ( *tbuff != '\n' )
@@ -190,7 +187,7 @@ int Style_Parser::parse_to_eol(char s) {
// Parse a block comment until end of comment or buffer.
// Returns 0 if hit end of buffer, 1 otherwise.
//
-int Style_Parser::parse_block_comment() {
+int fld::widget::Style_Parser::parse_block_comment() {
char save = style;
style = 'C'; // block comment style
while ( len > 0 ) {
@@ -206,10 +203,11 @@ int Style_Parser::parse_block_comment() {
}
// Copy keyword from tbuff -> keyword[] buffer
-void Style_Parser::buffer_keyword() {
+void fld::widget::Style_Parser::buffer_keyword() {
char *key = keyword;
char *kend = key + sizeof(keyword) - 1; // end of buffer
- for ( const char *s=tbuff;
+ const char *s;
+ for (s =tbuff;
(islower(*s) || *s=='_') && (key < kend);
*key++ = *s++ ) { }
*key = 0; // terminate
@@ -218,7 +216,7 @@ void Style_Parser::buffer_keyword() {
// Parse over specified 'key'word in specified style 's'.
// Returns 0 if hit end of buffer, 1 otherwise.
//
-int Style_Parser::parse_over_key(const char *key, char s) {
+int fld::widget::Style_Parser::parse_over_key(const char *key, char s) {
char save = style;
style = s;
// Parse over the keyword while applying style to sbuff
@@ -232,7 +230,7 @@ int Style_Parser::parse_over_key(const char *key, char s) {
// Parse over angle brackets <..> in specified style.
// Returns 0 if hit end of buffer, 1 otherwise.
//
-int Style_Parser::parse_over_angles(char s) {
+int fld::widget::Style_Parser::parse_over_angles(char s) {
if ( *tbuff != '<' ) return 1; // not <..>, early exit
char save = style;
style = s;
@@ -248,7 +246,7 @@ int Style_Parser::parse_over_angles(char s) {
// spi.keyword[] will contain parsed word.
// Returns 0 if hit end of buffer, 1 otherwise.
//
-int Style_Parser::parse_keyword() {
+int fld::widget::Style_Parser::parse_keyword() {
// Parse into 'keyword' buffer
buffer_keyword();
char *key = keyword;
@@ -265,7 +263,7 @@ int Style_Parser::parse_keyword() {
// Style parse a quoted string, either "" or ''.
// Returns 0 if hit end of buffer, 1 otherwise.
//
-int Style_Parser::parse_quoted_string(char quote_char, // e.g. '"' or '\''
+int fld::widget::Style_Parser::parse_quoted_string(char quote_char, // e.g. '"' or '\''
char in_style) { // style for quoted text
style = in_style; // start string style
if ( !parse_over_char() ) return 0; // parse over opening quote
@@ -292,7 +290,7 @@ int Style_Parser::parse_quoted_string(char quote_char, // e.g. '"' or '\''
// Style parse a directive (#include, #define..)
// Returns 0 if hit end of buffer, 1 otherwise.
//
-int Style_Parser::parse_directive() {
+int fld::widget::Style_Parser::parse_directive() {
style = 'E'; // start directive style
if ( !parse_over_char() ) return 0; // Parse over '#'
if ( !parse_over_white() ) return 0; // Parse over any whitespace after '#'
@@ -306,7 +304,7 @@ int Style_Parser::parse_directive() {
// Style parse a line comment to end of line.
// Returns 0 if hit end of buffer, 1 otherwise.
//
-int Style_Parser::parse_line_comment() {
+int fld::widget::Style_Parser::parse_line_comment() {
return parse_to_eol('B');
}
@@ -315,7 +313,7 @@ int Style_Parser::parse_line_comment() {
// a continuation of a line, such as in a multiline #directive.
// Returns 0 if hit end of buffer, 1 otherwise.
//
-int Style_Parser::parse_escape() {
+int fld::widget::Style_Parser::parse_escape() {
const char no_crlf = 0;
if ( !parse_over_char(no_crlf) ) return 0; // backslash
if ( !parse_over_char(no_crlf) ) return 0; // char escaped
@@ -325,7 +323,7 @@ int Style_Parser::parse_escape() {
// Parse all other non-specific characters
// Returns 0 if hit end of buffer, 1 otherwise.
//
-int Style_Parser::parse_all_else() {
+int fld::widget::Style_Parser::parse_all_else() {
last = isalnum(*tbuff) || *tbuff == '_' || *tbuff == '.';
return parse_over_char();
}
diff --git a/fluid/widgets/Text_Viewer.cxx b/fluid/widgets/Text_Viewer.cxx
index 310fa6919..3cd89d4d8 100644
--- a/fluid/widgets/Text_Viewer.cxx
+++ b/fluid/widgets/Text_Viewer.cxx
@@ -20,15 +20,15 @@
#include "widgets/Text_Viewer.h"
-using namespace fld;
-using namespace fld::widget;
+
+
/**
Create a fld::widget::Text_Viewer widget.
\param[in] X, Y, W, H position and size of the widget
\param[in] L optional label
*/
-Text_Viewer::Text_Viewer(int X, int Y, int W, int H, const char *L)
+fld::widget::Text_Viewer::Text_Viewer(int X, int Y, int W, int H, const char *L)
: Fl_Text_Display(X, Y, W, H, L)
{
buffer(new Fl_Text_Buffer);
@@ -37,7 +37,7 @@ Text_Viewer::Text_Viewer(int X, int Y, int W, int H, const char *L)
/**
Avoid memory leaks.
*/
-Text_Viewer::~Text_Viewer() {
+fld::widget::Text_Viewer::~Text_Viewer() {
Fl_Text_Buffer *buf = mBuffer;
buffer(0);
delete buf;
@@ -46,7 +46,7 @@ Text_Viewer::~Text_Viewer() {
/**
Tricking Fl_Text_Display into using bearable colors for this specific task.
*/
-void Text_Viewer::draw()
+void fld::widget::Text_Viewer::draw()
{
Fl_Color c = Fl::get_color(FL_SELECTION_COLOR);
Fl::set_color(FL_SELECTION_COLOR, fl_color_average(FL_BACKGROUND_COLOR, FL_FOREGROUND_COLOR, 0.9f));