summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl_Preferences.H6
-rw-r--r--src/Fl_Preferences.cxx34
2 files changed, 36 insertions, 4 deletions
diff --git a/FL/Fl_Preferences.H b/FL/Fl_Preferences.H
index 54941beb5..5897a736a 100644
--- a/FL/Fl_Preferences.H
+++ b/FL/Fl_Preferences.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Preferences.H,v 1.1.2.9 2002/08/14 16:19:48 easysw Exp $"
+// "$Id: Fl_Preferences.H,v 1.1.2.10 2002/08/27 03:03:34 easysw Exp $"
//
// Preferences definitions for the Fast Light Tool Kit (FLTK).
//
@@ -46,6 +46,7 @@ public:
// enum Type { win32, macos, fltk };
Fl_Preferences( Root root, const char *vendor, const char *application );
+ Fl_Preferences( const char *path, const char *vendor, const char *application );
Fl_Preferences( Fl_Preferences&, const char *group );
Fl_Preferences( Fl_Preferences*, const char *group );
~Fl_Preferences();
@@ -139,6 +140,7 @@ private:
char *vendor_, *application_;
public:
RootNode( Fl_Preferences *, Root root, const char *vendor, const char *application );
+ RootNode( Fl_Preferences *, const char *path, const char *vendor, const char *application );
~RootNode();
int read();
int write();
@@ -155,5 +157,5 @@ private:
#endif // !Fl_Preferences_H
//
-// End of "$Id: Fl_Preferences.H,v 1.1.2.9 2002/08/14 16:19:48 easysw Exp $".
+// End of "$Id: Fl_Preferences.H,v 1.1.2.10 2002/08/27 03:03:34 easysw Exp $".
//
diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx
index 12f7e4f45..0eb03d083 100644
--- a/src/Fl_Preferences.cxx
+++ b/src/Fl_Preferences.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Preferences.cxx,v 1.1.2.18 2002/08/09 01:09:49 easysw Exp $"
+// "$Id: Fl_Preferences.cxx,v 1.1.2.19 2002/08/27 03:03:37 easysw Exp $"
//
// Preferences methods for the Fast Light Tool Kit (FLTK).
//
@@ -66,6 +66,18 @@ Fl_Preferences::Fl_Preferences( Root root, const char *vendor, const char *appli
/**
+ * create the initial preferences base
+ * - path: an application-supplied path
+ * example: Fl_Preferences base( "/usr/foo" );
+ */
+Fl_Preferences::Fl_Preferences( const char *path, const char *vendor, const char *application )
+{
+ node = new Node( "." );
+ rootNode = new RootNode( this, path, vendor, application );
+}
+
+
+/**
* create a Preferences node in relation to a parent node for reading and writing
* - parent: base name for group
* - group: group name (can contain '/' seperated group names)
@@ -669,6 +681,24 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
read();
}
+// create the root node
+// - construct the name of the file that will hold our preferences
+Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, const char *path, const char *vendor, const char *application )
+{
+ char filename[ FL_PATH_MAX ]; filename[0] = 0;
+
+ snprintf(filename, sizeof(filename), "%s/%s.prefs", path, application);
+
+ makePathForFile(filename);
+
+ prefs_ = prefs;
+ filename_ = strdup(filename);
+ vendor_ = strdup(vendor);
+ application_ = strdup(application);
+
+ read();
+}
+
// destroy the root node and all depending nodes
Fl_Preferences::RootNode::~RootNode()
{
@@ -1054,5 +1084,5 @@ char Fl_Preferences::Node::remove()
//
-// End of "$Id: Fl_Preferences.cxx,v 1.1.2.18 2002/08/09 01:09:49 easysw Exp $".
+// End of "$Id: Fl_Preferences.cxx,v 1.1.2.19 2002/08/27 03:03:37 easysw Exp $".
//