summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleo2000-07-17 00:00:03 +0000
committerleo2000-07-17 00:00:03 +0000
commit97eef4de5a5e841cabbacd5adc15307abd0eeaf9 (patch)
treef5aa23614400a01c9514cb0e5f7f2746b6eb6bab
parent1747b4aefeb736dfce752a89cb71e6ed313e7468 (diff)
Old functions no longer used, replaced by linux/profile.cpp
git-svn-id: http://svn.leocad.org/trunk@89 c7d43263-9d01-0410-8a33-9dba5d9f93d6
-rw-r--r--linux/custom.cpp144
-rw-r--r--linux/custom.h21
2 files changed, 0 insertions, 165 deletions
diff --git a/linux/custom.cpp b/linux/custom.cpp
deleted file mode 100644
index 0a7deec..0000000
--- a/linux/custom.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-// User preferences.
-//
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include "custom.h"
-
-// Variables
-
-userrc_t user_rc;
-
-
-// Functions
-
-static void create_rc (void);
-static void save_rc (void);
-static void read_rc (void);
-static char* preferences_path (char *buf);
-
-
-static char* preferences_path (char *buf)
-{
- char *ptr;
-
- if ((ptr = getenv ("HOME")) == NULL)
- {
- printf ("Can't get Environment Variable HOME... Aborting.\n");
- exit (1);
- }
-
- sprintf (buf, "%s/.LeoCAD", ptr);
- return buf;
-}
-
-// Set the default preferences.
-static void create_rc (void)
-{
- memset (&user_rc, 0, sizeof (user_rc));
-
- user_rc.view_main_toolbar = 1;
- user_rc.view_tool_toolbar = 1;
- user_rc.view_anim_toolbar = 1;
- user_rc.toolbar_style = GTK_TOOLBAR_ICONS;
-}
-
-static void save_rc (void)
-{
- FILE *preferences_file;
- char this_path[1024];
-
- preferences_path (this_path);
- if ((preferences_file = fopen (this_path, "w")) == NULL)
- {
-// alert_ok ("Error", "Can't save preferences ini file.", "Ok");
- return;
- }
- fprintf (preferences_file, "# LeoCAD preferences file.\n\n");
-
-#define CUSTOM_SECTION(a) fprintf (preferences_file, "\n\n[%s]\n", a)
-#define CUSTOM_SAVE_INT(a,b) fprintf (preferences_file, "%s=%i\n", a, (int) b)
-#define CUSTOM_SAVE_BOOL(a,b) fprintf (preferences_file, "%s=%i\n", a, b ? 1 : 0)
-#define CUSTOM_SAVE_STRING(a,b) fprintf (preferences_file, "%s=%s\n", a, b)
-
- // VERSION
-// CUSTOM_SECTION ("VERSION");
-// CUSTOM_SAVE_STRING ("PROGRAM_VERSION", user_rc.program_version);
-
- // VIEW
- CUSTOM_SECTION ("View");
- CUSTOM_SAVE_BOOL ("Standard", user_rc.view_main_toolbar);
- CUSTOM_SAVE_BOOL ("Tools", user_rc.view_tool_toolbar);
- CUSTOM_SAVE_BOOL ("Animation", user_rc.view_anim_toolbar);
- CUSTOM_SAVE_INT ("TOOLBAR_STYLE", user_rc.toolbar_style);
-
- fprintf (preferences_file, "\n\n# END OF LeoCAD preferences file.");
- fflush (preferences_file);
- fclose (preferences_file);
-}
-
-static void read_rc (void)
-{
- FILE *preferences_file;
- char this_path[1024];
- char this_line[256];
- int this_line_number = 0;
-
- preferences_path (this_path);
-
- if (access (this_path, F_OK))
- return;
-
- if ((preferences_file = fopen (this_path, "r")) == NULL)
- return;
-
-#define FIELD_INT (int) atoi(strchr(this_line,'=')+1)
-#define FIELD_BOOL (FIELD_INT!=0)
-#define FIELD_STRING strchr(this_line,'=')+1
-
-#define CUSTOM_LOAD_INT(a,b); if(strstr (this_line, a"=")){b = FIELD_INT;continue;}
-#define CUSTOM_LOAD_BOOL(a,b); if(strstr (this_line, a"=")){b = FIELD_BOOL;continue;}
-#define CUSTOM_LOAD_STRING(a,b); if(strstr (this_line, a"=")){strcpy(b, FIELD_STRING);continue;}
-
- while (fgets (this_line, sizeof (this_line), preferences_file) != NULL)
- {
- this_line_number++;
-
- if (this_line[strlen (this_line) - 1] == '\n')
- this_line[strlen (this_line) - 1] = 0;
-
- if (!strlen (this_line))
- continue;
- if (this_line[0] == '#')
- continue;
- if (this_line[0] == '[')
- continue;
-
- // VERSION
-// CUSTOM_LOAD_STRING ("PROGRAM_VERSION", user_rc.program_version);
-
- // VIEW
- CUSTOM_LOAD_BOOL ("Standard", user_rc.view_main_toolbar);
- CUSTOM_LOAD_BOOL ("Tools", user_rc.view_tool_toolbar);
- CUSTOM_LOAD_BOOL ("Animation", user_rc.view_anim_toolbar);
- CUSTOM_LOAD_INT ("TOOLBAR_STYLE", (int) user_rc.toolbar_style);
-
- printf ("LeoCAD : Syntax error in %s\n", this_path);
- printf ("Line %i : %s\n", this_line_number, this_line);
- }
-
- fclose (preferences_file);
-}
-
-void init_rc (void)
-{
- char this_path[1024];
-
- preferences_path (this_path);
-
- create_rc ();
- access (this_path, F_OK) ? save_rc () : read_rc ();
-}
-
diff --git a/linux/custom.h b/linux/custom.h
deleted file mode 100644
index 4fd6ee2..0000000
--- a/linux/custom.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef _CUSTOM_H_
-#define _CUSTOM_H_
-
-#include <gtk/gtk.h>
-
-// User preferences
-typedef struct
-{
- char view_main_toolbar;
- char view_tool_toolbar;
- char view_anim_toolbar;
-
- GtkToolbarStyle toolbar_style;
-} userrc_t;
-
-extern userrc_t user_rc;
-
-
-void init_rc (void);
-
-#endif