summaryrefslogtreecommitdiff
path: root/fluid/proj
diff options
context:
space:
mode:
Diffstat (limited to 'fluid/proj')
-rw-r--r--fluid/proj/i18n.cxx28
-rw-r--r--fluid/proj/i18n.h19
-rw-r--r--fluid/proj/mergeback.cxx20
-rw-r--r--fluid/proj/mergeback.h6
-rw-r--r--fluid/proj/undo.cxx32
-rw-r--r--fluid/proj/undo.h6
6 files changed, 46 insertions, 65 deletions
diff --git a/fluid/proj/i18n.cxx b/fluid/proj/i18n.cxx
index 71ba892a1..c726a56d0 100644
--- a/fluid/proj/i18n.cxx
+++ b/fluid/proj/i18n.cxx
@@ -23,7 +23,7 @@ static char *dup_str(const char *s) {
return s ? fl_strdup(s) : 0;
}
-fld::proj::I18n::I18n(Project &p) : project_(p) {
+I18n::I18n(Project &p) : project_(p) {
type = FLD_I18N_TYPE_NONE;
gnu_include = fl_strdup("<libintl.h>");
gnu_conditional = 0;
@@ -35,7 +35,7 @@ fld::proj::I18n::I18n(Project &p) : project_(p) {
posix_set = fl_strdup("1");
}
-fld::proj::I18n::~I18n() {
+I18n::~I18n() {
if (gnu_include) free(gnu_include);
if (gnu_conditional) free(gnu_conditional);
if (gnu_function) free(gnu_function);
@@ -46,42 +46,42 @@ fld::proj::I18n::~I18n() {
if (posix_set) free(posix_set);
}
-void fld::proj::I18n::set_gnu_include(const char *s) {
+void I18n::set_gnu_include(const char *s) {
if (gnu_include) free(gnu_include);
gnu_include = dup_str(s);
}
-void fld::proj::I18n::set_gnu_conditional(const char *s) {
+void I18n::set_gnu_conditional(const char *s) {
if (gnu_conditional) free(gnu_conditional);
gnu_conditional = dup_str(s);
}
-void fld::proj::I18n::set_gnu_function(const char *s) {
+void I18n::set_gnu_function(const char *s) {
if (gnu_function) free(gnu_function);
gnu_function = dup_str(s);
}
-void fld::proj::I18n::set_gnu_static_function(const char *s) {
+void I18n::set_gnu_static_function(const char *s) {
if (gnu_static_function) free(gnu_static_function);
gnu_static_function = dup_str(s);
}
-void fld::proj::I18n::set_posix_include(const char *s) {
+void I18n::set_posix_include(const char *s) {
if (posix_include) free(posix_include);
posix_include = dup_str(s);
}
-void fld::proj::I18n::set_posix_conditional(const char *s) {
+void I18n::set_posix_conditional(const char *s) {
if (posix_conditional) free(posix_conditional);
posix_conditional = dup_str(s);
}
-void fld::proj::I18n::set_posix_file(const char *s) {
+void I18n::set_posix_file(const char *s) {
if (posix_file) free(posix_file);
posix_file = dup_str(s);
}
-void fld::proj::I18n::set_posix_set(const char *s) {
+void I18n::set_posix_set(const char *s) {
if (posix_set) free(posix_set);
posix_set = dup_str(s);
}
@@ -89,7 +89,7 @@ void fld::proj::I18n::set_posix_set(const char *s) {
/**
Reset all project setting to create a new empty project.
*/
-void fld::proj::I18n::reset() {
+void I18n::reset() {
type = FLD_I18N_TYPE_NONE;
set_gnu_include("<libintl.h>");
@@ -103,9 +103,9 @@ void fld::proj::I18n::reset() {
set_posix_set("1");
}
-void fld::proj::I18n::read(io::Project_Reader &f, const char *key) {
+void I18n::read(Project_Reader &f, const char *key) {
if (!strcmp(key, "i18n_type")) {
- type = (fld::I18n_Type)(atoi(f.read_word()));
+ type = (I18n_Type)(atoi(f.read_word()));
} else if (!strcmp(key, "i18n_gnu_function")) {
set_gnu_function(f.read_word());
} else if (!strcmp(key, "i18n_gnu_static_function")) {
@@ -129,7 +129,7 @@ void fld::proj::I18n::read(io::Project_Reader &f, const char *key) {
}
}
-void fld::proj::I18n::write(io::Project_Writer &f) const {
+void I18n::write(Project_Writer &f) const {
if ((type != FLD_I18N_TYPE_NONE)) {
f.write_string("\ni18n_type %d", (int)(type));
switch (type) {
diff --git a/fluid/proj/i18n.h b/fluid/proj/i18n.h
index 65ef72bf6..262a6347c 100644
--- a/fluid/proj/i18n.h
+++ b/fluid/proj/i18n.h
@@ -21,8 +21,6 @@
#include <stdlib.h>
#include <string.h>
-namespace fld {
-
class Project;
/**
@@ -30,22 +28,14 @@ class Project;
*/
typedef int I18n_Type;
-} // namespace fld
-
enum {
FLD_I18N_TYPE_NONE = 0, ///< No i18n, all strings are litearals
FLD_I18N_TYPE_GNU, ///< GNU gettext internationalization
FLD_I18N_TYPE_POSIX ///< Posix catgets internationalization
};
-namespace fld {
-
-namespace io {
class Project_Reader;
class Project_Writer;
-}
-
-namespace proj {
/**
Data and settings for a FLUID project file.
@@ -56,7 +46,7 @@ public:
Project &project_;
/// One of the available internationalization types.
- fld::I18n_Type type;
+ I18n_Type type;
/// Include file for GNU i18n, writes an #include statement into the source
/// file. This is usually `<libintl.h>` or `"gettext.h"` for GNU gettext.
char *gnu_include;
@@ -83,8 +73,8 @@ public: // Methods
I18n(Project &p);
~I18n();
void reset();
- void read(io::Project_Reader &f, const char *key);
- void write(io::Project_Writer &f) const;
+ void read(Project_Reader &f, const char *key);
+ void write(Project_Writer &f) const;
void set_gnu_include(const char *s);
void set_gnu_conditional(const char *s);
@@ -96,9 +86,6 @@ public: // Methods
void set_posix_set(const char *s);
};
-} // namespace proj
-
-} // namespace fld
#endif // FLUID_PROJ_I18N_H
diff --git a/fluid/proj/mergeback.cxx b/fluid/proj/mergeback.cxx
index 2d553aedb..827a9505b 100644
--- a/fluid/proj/mergeback.cxx
+++ b/fluid/proj/mergeback.cxx
@@ -91,7 +91,7 @@ extern void redraw_browser();
Returns 0 if nothing changed, and 1 if it merged any changes back, and -1 if
there were conflicts.
- \note this function is currently part of fld::io::Code_Writer to get easy access
+ \note this function is currently part of Code_Writer to get easy access
to our crc32 code that also wrote the code file originally.
\param[in] s path and filename of the source code file
@@ -100,7 +100,7 @@ extern void redraw_browser();
\return -2 if no code file was found
\return see above
*/
-static int merge_back(fld::Project &proj, const char *s, const char *p, Mergeback::Task task) {
+static int merge_back(Project &proj, const char *s, const char *p, Mergeback::Task task) {
if (proj.write_mergeback_data) {
Mergeback mergeback(proj);
return mergeback.merge_back(s, p, task);
@@ -111,7 +111,7 @@ static int merge_back(fld::Project &proj, const char *s, const char *p, Mergebac
}
/** Allocate and initialize MergeBack class. */
-Mergeback::Mergeback(fld::Project &proj)
+Mergeback::Mergeback(Project &proj)
: proj_(proj),
code(0),
line_no(0),
@@ -253,7 +253,7 @@ void Mergeback::analyse_callback(unsigned long code_crc, unsigned long tag_crc,
if (cb && len) memcpy(cb_nl, cb, len);
cb_nl[len] = '\n';
cb_nl[len + 1] = '\0';
- unsigned long project_crc = fld::io::Code_Writer::block_crc(cb_nl);
+ unsigned long project_crc = Code_Writer::block_crc(cb_nl);
free(cb_nl);
// check if the code and project crc are the same, so this modification was already applied
if (project_crc!=code_crc) {
@@ -281,7 +281,7 @@ void Mergeback::analyse_code(unsigned long code_crc, unsigned long tag_crc, int
if (code && len) memcpy(code_nl, code, len);
code_nl[len] = '\n';
code_nl[len + 1] = '\0';
- unsigned long project_crc = fld::io::Code_Writer::block_crc(code_nl);
+ unsigned long project_crc = Code_Writer::block_crc(code_nl);
free(code_nl);
// check if the code and project crc are the same, so this modification was already applied
if (project_crc!=code_crc) {
@@ -448,7 +448,7 @@ int Mergeback::analyse() {
const char *tag = find_mergeback_tag(line);
if (!tag) {
// if this line has no tag, add the contents to the CRC and continue
- code_crc = fld::io::Code_Writer::block_crc(line, -1, code_crc, &line_start);
+ code_crc = Code_Writer::block_crc(line, -1, code_crc, &line_start);
} else {
// if this line has a tag, read all tag data
Tag tag_type = FLD_MERGEBACK_TAG_UNUSED_;
@@ -494,7 +494,7 @@ int Mergeback::apply_callback(long block_end, long block_start, unsigned long co
if (cb && len) memcpy(cb_nl, cb, len);
cb_nl[len] = '\n';
cb_nl[len + 1] = '\0';
- unsigned long project_crc = fld::io::Code_Writer::block_crc(cb_nl);
+ unsigned long project_crc = Code_Writer::block_crc(cb_nl);
free(cb_nl);
if (project_crc!=code_crc) {
char *block = read_and_unindent_block(block_start, block_end);
@@ -518,7 +518,7 @@ int Mergeback::apply_code(long block_end, long block_start, unsigned long code_c
if (code && len) memcpy(code_nl, code, len);
code_nl[len] = '\n';
code_nl[len + 1] = '\0';
- unsigned long project_crc = fld::io::Code_Writer::block_crc(code_nl);
+ unsigned long project_crc = Code_Writer::block_crc(code_nl);
free(code_nl);
if (project_crc!=code_crc) {
char *block = read_and_unindent_block(block_start, block_end);
@@ -557,7 +557,7 @@ int Mergeback::apply() {
const char *tag = find_mergeback_tag(line);
if (!tag) {
// if this line has no tag, add the contents to the CRC and continue
- code_crc = fld::io::Code_Writer::block_crc(line, -1, code_crc, &line_start);
+ code_crc = Code_Writer::block_crc(line, -1, code_crc, &line_start);
block_end = ::ftell(code);
} else {
// if this line has a tag, read all tag data
@@ -654,7 +654,7 @@ int Mergeback::merge_back(const char *s, const char *p, Task task) {
\return 0 if MergeBack is not enabled, or the result of the merge_back function.
\see Mergeback::merge_back(const char *s, const char *p, Task task)
*/
-int mergeback_code_files(fld::Project &proj, Mergeback::Feedback feedback)
+int mergeback_code_files(Project &proj, Mergeback::Feedback feedback)
{
static bool recursion_lock = false;
if (recursion_lock) return 2;
diff --git a/fluid/proj/mergeback.h b/fluid/proj/mergeback.h
index 04a9dc902..c1e877d60 100644
--- a/fluid/proj/mergeback.h
+++ b/fluid/proj/mergeback.h
@@ -22,7 +22,7 @@
#include <stdint.h>
#include <stdio.h>
-namespace fld { class Project; }
+class Project;
/** Class that implements the MergeBack functionality.
\see merge_back(const char *s, int task)
@@ -50,7 +50,7 @@ public:
enum Feedback { QUIET = 0, CHATTY = 1 };
protected:
/// Apply mergeback for this project.
- fld::Project &proj_;
+ Project &proj_;
/// Pointer to the C++ code file.
FILE *code;
/// Current line number in the C++ code file.
@@ -80,7 +80,7 @@ protected:
static bool read_tag(const char *tag, Tag *prev_type, uint16_t *uid, uint32_t *crc);
public:
- Mergeback(fld::Project &proj);
+ Mergeback(Project &proj);
~Mergeback();
int merge_back(const char *s, const char *p, Task task);
int ask_user_to_merge(const char *s, const char *p);
diff --git a/fluid/proj/undo.cxx b/fluid/proj/undo.cxx
index d3444c91a..829b2d4d4 100644
--- a/fluid/proj/undo.cxx
+++ b/fluid/proj/undo.cxx
@@ -47,11 +47,11 @@
extern Fl_Window* the_panel;
-fld::proj::Undo::Undo(fld::Project &p)
+Undo::Undo(Project &p)
: proj_( p )
{ }
-fld::proj::Undo::~Undo() {
+Undo::~Undo() {
// TODO: delete old undo files when calling the destructor.
}
@@ -60,7 +60,7 @@ fld::proj::Undo::~Undo() {
// The filename is constructed in a static internal buffer and
// this buffer is overwritten by every call of this function.
// The return value is a pointer to this internal string.
-char *fld::proj::Undo::filename(int level) {
+char *Undo::filename(int level) {
if (!path_len_) {
Fluid.preferences.getUserdataPath(path_, sizeof(path_));
path_len_ = (unsigned int)strlen(path_);
@@ -75,7 +75,7 @@ char *fld::proj::Undo::filename(int level) {
// Redo menu callback
-void fld::proj::Undo::redo() {
+void Undo::redo() {
// int undo_item = main_menubar->find_index(undo_cb);
// int redo_item = main_menubar->find_index(redo_cb);
once_type_ = FLD_UNDO_ONCETYPE_ALWAYS;
@@ -91,7 +91,7 @@ void fld::proj::Undo::redo() {
widget_browser->new_list();
}
int reload_panel = (the_panel && the_panel->visible());
- if (!fld::io::read_file(proj_, filename(current_ + 1), 0)) {
+ if (!read_file(proj_, filename(current_ + 1), 0)) {
// Unable to read checkpoint file, don't redo...
widget_browser->rebuild();
proj_.update_settings_dialog();
@@ -119,7 +119,7 @@ void fld::proj::Undo::redo() {
}
// Undo menu callback
-void fld::proj::Undo::undo() {
+void Undo::undo() {
// int undo_item = main_menubar->find_index(undo_cb);
// int redo_item = main_menubar->find_index(redo_cb);
once_type_ = FLD_UNDO_ONCETYPE_ALWAYS;
@@ -130,7 +130,7 @@ void fld::proj::Undo::undo() {
}
if (current_ == last_) {
- fld::io::write_file(proj_, filename(current_));
+ write_file(proj_, filename(current_));
}
suspend();
@@ -142,7 +142,7 @@ void fld::proj::Undo::undo() {
widget_browser->new_list();
}
int reload_panel = (the_panel && the_panel->visible());
- if (!fld::io::read_file(proj_, filename(current_ - 1), 0)) {
+ if (!read_file(proj_, filename(current_ - 1), 0)) {
// Unable to read checkpoint file, don't undo...
widget_browser->rebuild();
proj_.update_settings_dialog();
@@ -180,7 +180,7 @@ void fld::proj::Undo::undo() {
\param[in] type set a new type, or set to 0 to clear the once_type without setting a checkpoint
\return 1 if the checkpoint was set, 0 if this is a repeating event
*/
-int fld::proj::Undo::checkpoint(OnceType type) {
+int Undo::checkpoint(OnceType type) {
if (type == FLD_UNDO_ONCETYPE_ALWAYS) {
once_type_ = FLD_UNDO_ONCETYPE_ALWAYS;
return 0;
@@ -197,7 +197,7 @@ int fld::proj::Undo::checkpoint(OnceType type) {
}
// Save current file to undo buffer
-void fld::proj::Undo::checkpoint() {
+void Undo::checkpoint() {
// printf("checkpoint(): current_=%d, paused_=%d, modflag=%d\n",
// current_, paused_, modflag);
@@ -210,7 +210,7 @@ void fld::proj::Undo::checkpoint() {
// Save the current UI to a checkpoint file...
const char *file = filename(current_);
- if (!fld::io::write_file(proj_, file)) {
+ if (!write_file(proj_, file)) {
// Don't attempt to do undo stuff if we can't write a checkpoint file...
perror(file);
return;
@@ -231,7 +231,7 @@ void fld::proj::Undo::checkpoint() {
}
// Clear undo buffer
-void fld::proj::Undo::clear() {
+void Undo::clear() {
// int undo_item = main_menubar->find_index(undo_cb);
// int redo_item = main_menubar->find_index(redo_cb);
// Remove old checkpoint files...
@@ -251,19 +251,19 @@ void fld::proj::Undo::clear() {
}
// Resume undo checkpoints
-void fld::proj::Undo::resume() {
+void Undo::resume() {
paused_--;
}
// Suspend undo checkpoints
-void fld::proj::Undo::suspend() {
+void Undo::suspend() {
paused_++;
}
-void fld::proj::Undo::undo_cb(Fl_Widget *, void *) {
+void Undo::undo_cb(Fl_Widget *, void *) {
Fluid.proj.undo.undo();
}
-void fld::proj::Undo::redo_cb(Fl_Widget *, void *) {
+void Undo::redo_cb(Fl_Widget *, void *) {
Fluid.proj.undo.redo();
}
diff --git a/fluid/proj/undo.h b/fluid/proj/undo.h
index de038908a..a50346faf 100644
--- a/fluid/proj/undo.h
+++ b/fluid/proj/undo.h
@@ -21,12 +21,8 @@
class Fl_Widget;
-namespace fld {
-
class Project;
-namespace proj {
-
enum {
FLD_UNDO_ONCETYPE_ALWAYS = 0,
FLD_UNDO_ONCETYPE_WINDOW_RESIZE
@@ -88,8 +84,6 @@ public:
static void undo_cb(Fl_Widget *, void *);
};
-} // namespace fld
-} // namespace proj
#endif // !undo_h