diff options
Diffstat (limited to 'fluid/io/Project_Reader.cxx')
| -rw-r--r-- | fluid/io/Project_Reader.cxx | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/fluid/io/Project_Reader.cxx b/fluid/io/Project_Reader.cxx index 3bf9608a3..54baa9a85 100644 --- a/fluid/io/Project_Reader.cxx +++ b/fluid/io/Project_Reader.cxx @@ -41,9 +41,6 @@ /// \defgroup flfile .fl Project File Operations /// \{ -using namespace fld; -using namespace fld::io; - // This file contains code to read and write .fl files. /// If set, we read an old fdesign file and widget y coordinates need to be flipped. @@ -85,7 +82,7 @@ static int hexdigit(int x) { Oh how I wish sometimes we would upgrade to modern C++. \param[in] length minimum length in bytes */ -void Project_Reader::expand_buffer(int length) { +void fld::io::Project_Reader::expand_buffer(int length) { if (length >= buflen) { if (!buflen) { buflen = length+1; @@ -99,13 +96,13 @@ void Project_Reader::expand_buffer(int length) { } /** \brief Construct local project reader. */ -Project_Reader::Project_Reader(Project &proj) +fld::io::Project_Reader::Project_Reader(Project &proj) : proj_(proj) { } /** \brief Release project reader resources. */ -Project_Reader::~Project_Reader() +fld::io::Project_Reader::~Project_Reader() { // fname is not copied, so do not free it if (buffer) @@ -117,7 +114,7 @@ Project_Reader::~Project_Reader() \param[in] s filename, if 0, read from stdin instead \return 0 if the operation failed, 1 if it succeeded */ -int Project_Reader::open_read(const char *s) { +int fld::io::Project_Reader::open_read(const char *s) { lineno = 1; if (!s) { fin = stdin; @@ -136,7 +133,7 @@ int Project_Reader::open_read(const char *s) { Close the .fl file. \return 0 if the operation failed, 1 if it succeeded */ -int Project_Reader::close_read() { +int fld::io::Project_Reader::close_read() { if (fin != stdin) { int x = fclose(fin); fin = 0; @@ -149,7 +146,7 @@ int Project_Reader::close_read() { Return the name part of the current filename and path. \return a pointer into a string that is not owned by this class */ -const char *Project_Reader::filename_name() { +const char *fld::io::Project_Reader::filename_name() { return fl_filename_name(fname); } @@ -159,7 +156,7 @@ const char *Project_Reader::filename_name() { values, and \\o### octal values. \return a character in the ASCII range */ -int Project_Reader::read_quoted() { // read whatever character is after a \ . +int fld::io::Project_Reader::read_quoted() { // read whatever character is after a \ . int c,d,x; switch(c = nextchar()) { case '\n': lineno++; return -1; @@ -204,7 +201,7 @@ int Project_Reader::read_quoted() { // read whatever character is after a \ a previous call, and there is no need to waste time searching for them. \return the last node that was created */ -Node *Project_Reader::read_children(Node *p, int merge, Strategy strategy, char skip_options) { +Node *fld::io::Project_Reader::read_children(Node *p, int merge, Strategy strategy, char skip_options) { Fluid.proj.tree.current = p; Node *last_child_read = 0; Node *t = 0; @@ -388,7 +385,7 @@ Node *Project_Reader::read_children(Node *p, int merge, Strategy strategy, char \param[in] strategy add new nodes after current or as last child \return 0 if the operation failed, 1 if it succeeded */ -int Project_Reader::read_project(const char *filename, int merge, Strategy strategy) { +int fld::io::Project_Reader::read_project(const char *filename, int merge, Strategy strategy) { Node *o; proj_.undo.suspend(); read_version = 0.0; @@ -438,7 +435,7 @@ int Project_Reader::read_project(const char *filename, int merge, Strategy strat operations. \param[in] format printf style format string, followed by an argument list */ -void Project_Reader::read_error(const char *format, ...) { +void fld::io::Project_Reader::read_error(const char *format, ...) { va_list args; va_start(args, format); if (!fin) { // FIXME: this line suppresses any error messages in interactive mode @@ -471,7 +468,7 @@ void Project_Reader::read_error(const char *format, ...) { overwrite this buffer. If wantbrace is not set, but we read a leading '{', the returned string will be stripped of its leading and trailing braces. */ -const char *Project_Reader::read_word(int wantbrace) { +const char *fld::io::Project_Reader::read_word(int wantbrace) { int x; // skip all the whitespace before it: @@ -541,7 +538,7 @@ const char *Project_Reader::read_word(int wantbrace) { /** Read a word and interpret it as an integer value. \return integer value, or 0 if the word is not an integer */ -int Project_Reader::read_int() { +int fld::io::Project_Reader::read_int() { const char *word = read_word(); if (word) { return atoi(word); @@ -557,7 +554,7 @@ int Project_Reader::read_int() { \param[out] value string \return 0 if end of file, else 1 */ -int Project_Reader::read_fdesign_line(const char*& name, const char*& value) { +int fld::io::Project_Reader::read_fdesign_line(const char*& name, const char*& value) { int length = 0; int x; // find a colon: @@ -646,6 +643,7 @@ static const char *class_matcher[] = { static void forms_end(Fl_Group *g, int flip) { // set the dimensions of a group to surround its contents const int nc = g->children(); + int i; if (nc && !g->w()) { Fl_Widget*const* a = g->array(); Fl_Widget* o = *a++; @@ -653,7 +651,7 @@ static void forms_end(Fl_Group *g, int flip) { int ry = o->y(); int rw = rx+o->w(); int rh = ry+o->h(); - for (int i = nc - 1; i--;) { + for (i = nc - 1; i--;) { o = *a++; if (o->x() < rx) rx = o->x(); if (o->y() < ry) ry = o->y(); @@ -667,7 +665,7 @@ static void forms_end(Fl_Group *g, int flip) { Fl_Widget* o = (g->as_window()) ? g : g->window(); int Y = o->h(); Fl_Widget*const* a = g->array(); - for (int i = nc; i--;) { + for (i = nc; i--;) { Fl_Widget* ow = *a++; int newy = Y - ow->y() - ow->h(); ow->Fl_Widget::resize(ow->x(), newy, ow->w(), ow->h()); @@ -683,7 +681,7 @@ static void forms_end(Fl_Group *g, int flip) { FLTK widgets. \see http://xforms-toolkit.org */ -void Project_Reader::read_fdesign() { +void fld::io::Project_Reader::read_fdesign() { int fdesign_magic = atoi(read_word()); fdesign_flip = (fdesign_magic < 13000); Widget_Node *window = 0; @@ -721,7 +719,8 @@ void Project_Reader::read_fdesign() { group = widget = 0; Fluid.proj.tree.current = window; } else { - for (int i = 0; class_matcher[i]; i += 2) + int i; + for (i = 0; class_matcher[i]; i += 2) if (!strcmp(value,class_matcher[i])) { value = class_matcher[i+1]; break;} widget = (Widget_Node*)add_new_widget_from_file(value, Strategy::FROM_FILE_AS_LAST_CHILD); |
