summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2010-03-01 20:53:21 +0000
committerMatthias Melcher <fltk@matthiasm.com>2010-03-01 20:53:21 +0000
commit49df7f85d875b3d8404d4f3206d1fced6393c1af (patch)
tree2b7edaeccf9f09f550388d2bc0bd673f48f1bb79
parent6a7003164704a87872ae45d141736f3006dc39a3 (diff)
Additions to the Database Editor.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7187 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--fltk.db24
-rw-r--r--fluid/ide_support.cxx81
-rw-r--r--fluid/ide_support_ui.cxx40
-rw-r--r--fluid/ide_support_ui.fl48
-rw-r--r--fluid/ide_support_ui.h3
5 files changed, 156 insertions, 40 deletions
diff --git a/fltk.db b/fltk.db
index bb660343e..23894968e 100644
--- a/fltk.db
+++ b/fltk.db
@@ -5,6 +5,9 @@
[.]
projectName:fltk
+databaseFormat:FLUID_IDE_DB
+databaseVersion:1.0
+projectVersion:1.3.0
[./targets]
@@ -2199,6 +2202,9 @@ refUUID:9AFEE04E-0E02-4697-B615-91B4D887674E
refUUID:982AD0F7-700A-4C40-846E-A23239AB0E2D
+[./targets/tests/29FBDC99-F1CD-410A-BB9F-79B6853CF41F/sources]
+
+
[./targets/tests/A80C35E8-4173-446F-9FE6-EED946E21370]
name:file_chooser
@@ -2695,6 +2701,9 @@ refUUID:9AFEE04E-0E02-4697-B615-91B4D887674E
refUUID:982AD0F7-700A-4C40-846E-A23239AB0E2D
+[./targets/tests/29D8C656-F8D8-42A4-8D85-B5A3921E5E0A/sources]
+
+
[./targets/tests/7B7BA865-F483-41BF-A34E-BF3C1DEC5AD0]
name:input
@@ -3211,6 +3220,9 @@ refUUID:9AFEE04E-0E02-4697-B615-91B4D887674E
refUUID:982AD0F7-700A-4C40-846E-A23239AB0E2D
+[./targets/tests/20E51515-F82E-4C0D-8D21-84F90CCEB1EB/sources]
+
+
[./targets/tests/8BA2602D-F8DD-4F78-8AB6-76DF41D29099]
name:radio
@@ -3240,6 +3252,9 @@ refUUID:9AFEE04E-0E02-4697-B615-91B4D887674E
refUUID:982AD0F7-700A-4C40-846E-A23239AB0E2D
+[./targets/tests/8BA2602D-F8DD-4F78-8AB6-76DF41D29099/sources]
+
+
[./targets/tests/DDD31943-5ED5-4CCF-A4D6-6494416A4A23]
name:resizebox
@@ -3294,6 +3309,9 @@ refUUID:9AFEE04E-0E02-4697-B615-91B4D887674E
refUUID:982AD0F7-700A-4C40-846E-A23239AB0E2D
+[./targets/tests/BF668CC8-BD77-4440-8A9C-504BBE5C555F/sources]
+
+
[./targets/tests/169ADBF8-D7E5-4CDC-92EC-D0660F23AFBB]
name:scroll
@@ -3541,6 +3559,9 @@ refUUID:9AFEE04E-0E02-4697-B615-91B4D887674E
refUUID:982AD0F7-700A-4C40-846E-A23239AB0E2D
+[./targets/tests/C8EBC9CF-2CA1-46D3-ADEF-F0B768294B7F/sources]
+
+
[./targets/tests/C512D026-C885-46F5-A955-0EC64BD96CF7]
name:threads
@@ -3719,6 +3740,9 @@ refUUID:9AFEE04E-0E02-4697-B615-91B4D887674E
refUUID:982AD0F7-700A-4C40-846E-A23239AB0E2D
+[./targets/tests/84764B86-38CA-48AC-B49D-0101411A3C5D/sources]
+
+
[./files]
diff --git a/fluid/ide_support.cxx b/fluid/ide_support.cxx
index 53362928b..1cae20acc 100644
--- a/fluid/ide_support.cxx
+++ b/fluid/ide_support.cxx
@@ -331,7 +331,10 @@ int create_new_database(const char *filename)
// the db, we have to do that manually!
//db->clear();
+ db->set("databaseFormat", "FLUID_IDE_DB");
+ db->set("databaseVersion", "1.0");
db->set("projectName", "fltk");
+ db->set("projectVersion", "1.3.0");
Fl_Preferences targets_db(db, "targets");
Fl_IDE_Prefs files_db(*db, "files");
@@ -1135,8 +1138,83 @@ int create_new_database(const char *filename)
void ui_load_database(const char *filename)
{
+ char buf[1024];
+ float v = 0.0f;
+ int i, j;
+
+ // FIXME: must be global, so we can close it
Fl_Preferences *db = new Fl_Preferences(filename, "fltk.org", 0);
- db->copyTo(dbmanager_tree);
+
+ // Check if this is a database
+ if (db->entries()==0) {
+ fl_alert("%s\nis not a database", filename);
+ delete db;
+ return;
+ }
+
+ // Check if the database has the correct format
+ if (!db->entryExists("databaseFormat")) {
+ fl_alert("%s\nis not a Fluid database", filename);
+ delete db;
+ return;
+ }
+ db->get("databaseFormat", buf, "", 1024);
+ if (strcmp(buf, "FLUID_IDE_DB")!=0) {
+ fl_alert("%s\nis not a Fluid IDE database", filename);
+ delete db;
+ return;
+ }
+ db->get("databaseVersion", buf, "", 1024);
+ sscanf(buf, "%f", &v);
+ if (v>1.0f) {
+ fl_alert("The Fluid IDE database\n%s\nversion %f is not suported.", filename, v);
+ delete db;
+ return;
+ }
+
+ // set the dialog label to the project name
+ char *name; db->get("projectName", name, "unnamed");
+ char *vers; db->get("projectVersion", vers, "0.1");
+ sprintf(buf, "%s V%s", name, vers);
+ dbmanager_window->label(buf);
+ free(vers); free(name);
+
+ Fl_Preferences targetsDB(db, "targets");
+ Fl_Preferences filesDB(db, "files");
+ Fl_Tree_Item *ti;
+
+ // load all tests
+ ti = dbmanager_tree->add("Applications");
+
+ // load all tests
+ ti = dbmanager_tree->add("Libraries & Frameworks");
+
+ // load all tests
+ ti = dbmanager_tree->add("Test Applications");
+ Fl_Preferences testsDB(targetsDB, "tests");
+ for (i=0; i<testsDB.groups(); i++) {
+ Fl_Preferences testDB(testsDB, i);
+ testDB.get("name", buf, "DB-Error", 1024);
+ Fl_Tree_Item *tt = dbmanager_tree->add(ti, buf); tt->close();
+
+ if (testDB.groupExists("sources")) {
+ Fl_Tree_Item *ts = dbmanager_tree->add(tt, "Sources"); ts->close();
+ Fl_Preferences srcsDB(testDB, "sources");
+ for (j=0; j<srcsDB.groups(); j++) {
+ Fl_Preferences srcDB(srcsDB, j);
+ srcDB.get("refUUID", buf, "DBERROR", 1024);
+ Fl_File_Prefs fileDB(filesDB, buf);
+ Fl_Tree_Item *tb = dbmanager_tree->add(ts, fileDB.fullName());
+ tb->user_data(0L); // TODO: add the callback information here
+ }
+ }
+
+ //ts = dbmanager_tree->add(tt, "Dependencies");
+ //ts = dbmanager_tree->add(tt, "Libraries");
+ //ts = dbmanager_tree->add(tt, "Externals");
+ }
+
+
dbmanager_tree->redraw();
delete db;
}
@@ -1175,6 +1253,7 @@ public:
void show_panel() {
if (!dbmanager_window)
make_dbmanager_window();
+ dbmanager_window->label("IDE Database Manager");
dbmanager_window->show();
}
};
diff --git a/fluid/ide_support_ui.cxx b/fluid/ide_support_ui.cxx
index 5211b049d..b6507a6ce 100644
--- a/fluid/ide_support_ui.cxx
+++ b/fluid/ide_support_ui.cxx
@@ -33,24 +33,25 @@
Fl_Double_Window *dbmanager_window=(Fl_Double_Window *)0;
-static void cb_fileopen(Fl_Button*, void*) {
+Fl_Tree *dbmanager_tree=(Fl_Tree *)0;
+
+static void cb_Open(Fl_Button*, void*) {
const char *filename = fl_file_chooser("Load Database", "*.db", 0, 0);
if (filename) {
ui_load_database(filename);
};
}
-Fl_Tree *dbmanager_tree=(Fl_Tree *)0;
+static void cb_New(Fl_Button*, void*) {
+ const char *filename = fl_file_chooser("Load Database", "*.db", 0, 0);
+if (filename) {
+ ui_load_database(filename);
+};
+}
Fl_Double_Window* make_dbmanager_window() {
- { dbmanager_window = new Fl_Double_Window(409, 510);
- { new Fl_File_Input(80, 4, 280, 36, "Database:");
- } // Fl_File_Input* o
- { Fl_Button* o = new Fl_Button(360, 14, 36, 26, "@fileopen");
- o->labelcolor((Fl_Color)94);
- o->callback((Fl_Callback*)cb_fileopen);
- } // Fl_Button* o
- { dbmanager_tree = new Fl_Tree(12, 52, 208, 444);
+ { dbmanager_window = new Fl_Double_Window(427, 500);
+ { dbmanager_tree = new Fl_Tree(8, 8, 200, 480);
dbmanager_tree->box(FL_DOWN_BOX);
dbmanager_tree->color((Fl_Color)55);
dbmanager_tree->selection_color(FL_BACKGROUND_COLOR);
@@ -64,18 +65,27 @@ Fl_Double_Window* make_dbmanager_window() {
dbmanager_tree->showroot(0);
dbmanager_tree->labelsize(12);
} // Fl_Tree* dbmanager_tree
- { Fl_Group* o = new Fl_Group(232, 52, 164, 444);
- { new Fl_Button(304, 468, 92, 28, "Close");
- } // Fl_Button* o
- { Fl_Group* o = new Fl_Group(232, 128, 164, 340);
+ { Fl_Group* o = new Fl_Group(216, 8, 200, 444);
+ o->box(FL_ENGRAVED_BOX);
+ { Fl_Group* o = new Fl_Group(224, 271, 184, 172);
o->end();
Fl_Group::current()->resizable(o);
} // Fl_Group* o
- { Fl_Box* o = new Fl_Box(232, 52, 164, 76, "Show editor\nfor selected\nItem here");
+ { Fl_Box* o = new Fl_Box(224, 108, 184, 160, "Show editor\nfor selected\nItem here");
o->box(FL_THIN_DOWN_BOX);
} // Fl_Box* o
+ { Fl_Button* o = new Fl_Button(242, 60, 148, 28, "Open Database...");
+ o->callback((Fl_Callback*)cb_Open);
+ } // Fl_Button* o
+ { Fl_Button* o = new Fl_Button(242, 24, 148, 28, " (New Database... )");
+ o->callback((Fl_Callback*)cb_New);
+ o->deactivate();
+ } // Fl_Button* o
o->end();
} // Fl_Group* o
+ { Fl_Button* o = new Fl_Button(324, 460, 92, 28, "( Close )");
+ o->deactivate();
+ } // Fl_Button* o
dbmanager_window->end();
} // Fl_Double_Window* dbmanager_window
return dbmanager_window;
diff --git a/fluid/ide_support_ui.fl b/fluid/ide_support_ui.fl
index 75f38ad2b..539526ae8 100644
--- a/fluid/ide_support_ui.fl
+++ b/fluid/ide_support_ui.fl
@@ -37,48 +37,52 @@ decl {\#include <FL/Fl_Tree.H>} {public local
decl {\#include "ide_support.h"} {private global
}
-decl {\#include <FL/Fl_File_Chooser.H>} {selected private global
+decl {\#include <FL/Fl_File_Chooser.H>} {private global
}
Function {make_dbmanager_window()} {open
} {
Fl_Window dbmanager_window {open
- xywh {459 167 409 510} type Double resizable visible
+ xywh {459 167 427 500} type Double resizable visible
} {
- Fl_File_Input {} {
- label {Database:}
- xywh {80 4 280 36}
- }
- Fl_Button {} {
- label {@fileopen}
- callback {const char *filename = fl_file_chooser("Load Database", "*.db", 0, 0);
-if (filename) {
- ui_load_database(filename);
-}}
- xywh {360 14 36 26} labelcolor 94
- }
Fl_Box dbmanager_tree {
- xywh {12 52 208 444} box DOWN_BOX color 55 resizable
+ xywh {8 8 200 480} box DOWN_BOX color 55 resizable
code0 {dbmanager_tree->showroot(0);}
code1 {dbmanager_tree->labelsize(12);}
class Fl_Tree
}
Fl_Group {} {open
- xywh {232 52 164 444}
+ xywh {216 8 200 444} box ENGRAVED_BOX
} {
- Fl_Button {} {
- label Close
- xywh {304 468 92 28}
- }
Fl_Group {} {open
- xywh {232 128 164 340} resizable
+ xywh {224 271 184 172} resizable
} {}
Fl_Box {} {
label {Show editor
for selected
Item here}
- xywh {232 52 164 76} box THIN_DOWN_BOX
+ xywh {224 108 184 160} box THIN_DOWN_BOX
}
+ Fl_Button {} {
+ label {Open Database...}
+ callback {const char *filename = fl_file_chooser("Load Database", "*.db", 0, 0);
+if (filename) {
+ ui_load_database(filename);
+}}
+ xywh {242 60 148 28}
+ }
+ Fl_Button {} {
+ label { (New Database... )}
+ callback {const char *filename = fl_file_chooser("Load Database", "*.db", 0, 0);
+if (filename) {
+ ui_load_database(filename);
+}} selected
+ xywh {242 24 148 28} deactivate
+ }
+ }
+ Fl_Button {} {
+ label {( Close )}
+ xywh {324 460 92 28} deactivate
}
}
}
diff --git a/fluid/ide_support_ui.h b/fluid/ide_support_ui.h
index 9d36a0490..c3cabc069 100644
--- a/fluid/ide_support_ui.h
+++ b/fluid/ide_support_ui.h
@@ -33,11 +33,10 @@
#include <FL/Fl_Tree.H>
#include <FL/Fl_Double_Window.H>
extern Fl_Double_Window *dbmanager_window;
-#include <FL/Fl_File_Input.H>
-#include <FL/Fl_Button.H>
extern Fl_Tree *dbmanager_tree;
#include <FL/Fl_Group.H>
#include <FL/Fl_Box.H>
+#include <FL/Fl_Button.H>
Fl_Double_Window* make_dbmanager_window();
#endif