Mixed bag. Please see CHANGES.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7117 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher
2010-02-20 21:14:47 +00:00
parent 7ae0c170ad
commit 2f82fd0663
17 changed files with 732 additions and 346 deletions
+5
View File
@@ -1,5 +1,10 @@
CHANGES IN FLTK 1.3.0
- Removed redundant Fl_Group casts
- Added indexing to Fl_Preferences
- Integrated default menu into Demo test app
- Added automated Xcode IDE file generation to Fluid
- Fixed lost top item in Fluid's tree browser (STR #2233)
- Fixed crash in test/Editor when freeing buffer
too soon (STR #2294)
- Fixed Fl_Preferences Cygwin wide character bug (STR #2164)
+13 -4
View File
@@ -211,8 +211,19 @@ private:
RootNode *root_; // top_ bit set
};
char *path_;
Entry *entry_;
int nEntry_, NEntry_;
unsigned char dirty_:1;
unsigned char top_:1;
unsigned char indexed_:1;
// indexing routines
Node **index_;
int nIndex_, NIndex_;
void createIndex();
void updateIndex();
void deleteIndex();
public:
static int lastEntrySet;
public:
Node( const char *path );
~Node();
@@ -242,10 +253,8 @@ private:
int getEntry( const char *name );
char deleteEntry( const char *name );
void deleteAllEntries();
// public values
Entry *entry;
int nEntry, NEntry;
static int lastEntrySet;
int nEntry() { return nEntry_; }
Entry &entry(int i) { return entry_[i]; }
};
friend class Node;
+1 -1
View File
@@ -865,7 +865,7 @@ public:
} else {
table->hide();
}
Fl_Group::current((Fl_Group*)(Fl_Group::parent()));
Fl_Group::current(Fl_Group::parent());
}
Fl_Widget * const *array() {
return(table->array());
+2 -3
View File
@@ -239,13 +239,12 @@ inline void fl_redraw_object(Fl_Widget* o) {o->redraw();}
inline void fl_show_object(Fl_Widget* o) {o->show();}
inline void fl_hide_object(Fl_Widget* o) {o->hide();}
inline void fl_free_object(Fl_Widget* x) {delete x;}
inline void fl_delete_object(Fl_Widget* o) {((Fl_Group*)(o->parent()))->remove(*o);}
inline void fl_delete_object(Fl_Widget* o) {o->parent()->remove(*o);}
inline void fl_activate_object(Fl_Widget* o) {o->activate();}
inline void fl_deactivate_object(Fl_Widget* o) {o->deactivate();}
inline void fl_add_object(Fl_Window* f, Fl_Widget* x) {f->add(x);}
inline void fl_insert_object(Fl_Widget* o, Fl_Widget* b) {
((Fl_Group*)(b->parent()))->insert(*o,b);}
inline void fl_insert_object(Fl_Widget* o, Fl_Widget* b) {b->parent()->insert(*o,b);}
inline Fl_Window* FL_ObjWin(Fl_Widget* o) {return o->window();}
+1 -2
View File
@@ -739,8 +739,7 @@ Fl_Type *Fl_Data_Type::make() {
o->public_ = 1;
o->static_ = 1;
o->filename_ = 0;
//char buf[32]; sprintf(buf, "data_%08x", (unsigned int)o);
char buf[32]; sprintf(buf, "data_%p", o);
char buf[32]; sprintf(buf, "data_%016x", (unsigned long int)o);
o->name(buf);
o->add(p);
o->factory = this;
+4
View File
@@ -821,6 +821,10 @@ public:
virtual const char *help() = 0;
// handle a command and return the number of args used, or 0
virtual int arg(int argc, char **argv, int &i) = 0;
// optional test the plugin
virtual int test(const char *a1=0L, const char *a2=0L, const char *a3=0L) {
return 0;
}
};
+28
View File
@@ -1572,6 +1572,32 @@ void print_cb(Fl_Return_Button *, void *) {
}
#endif // WIN32 && !__CYGWIN__
void fltkdb_cb(Fl_Widget*, void*)
{
int i;
Fl_Plugin_Manager pm("commandline");
for (i=0; i<pm.plugins(); i++) {
Fl_Commandline_Plugin *pi = (Fl_Commandline_Plugin*)pm.plugin(i);
if (strcmp(pi->name(), "FltkDB.fluid.fltk.org")==0) {
pi->test("/Users/matt/dev/fltk-1.3.0/fltk.db");
break;
}
}
}
void dbxcode_cb(Fl_Widget*, void*)
{
int i;
Fl_Plugin_Manager pm("commandline");
for (i=0; i<pm.plugins(); i++) {
Fl_Commandline_Plugin *pi = (Fl_Commandline_Plugin*)pm.plugin(i);
if (strcmp(pi->name(), "ideXcode.fluid.fltk.org")==0) {
pi->test("/Users/matt/dev/fltk-1.3.0/fltk.db", "/Users/matt/dev/fltk-test");
break;
}
}
}
////////////////////////////////////////////////////////////////
extern Fl_Menu_Item New_Menu[];
@@ -1666,6 +1692,8 @@ Fl_Menu_Item Main_Menu[] = {
{"&Shell",0,0,0,FL_SUBMENU},
{"Execute &Command...",FL_ALT+'x',(Fl_Callback *)show_shell_window},
{"Execute &Again...",FL_ALT+'g',(Fl_Callback *)do_shell_command},
{"--fltkdb",0,(Fl_Callback *)fltkdb_cb,0,FL_MENU_INVISIBLE},
{"--dbxcode",0,(Fl_Callback *)dbxcode_cb,0,FL_MENU_INVISIBLE},
{0},
{"&Help",0,0,0,FL_SUBMENU},
{"&About FLUID...",0,about_cb},
+276 -232
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -76,7 +76,7 @@ public:
Fl_Preferences::ID add_fl(Fl_IDE_Prefs &fdb, const char *pathAndName);
Fl_Preferences::ID depends_on(Fl_IDE_Prefs &dep);
Fl_Preferences::ID add_lib(Fl_IDE_Prefs &lib);
Fl_Preferences::ID add_external_lib(Fl_IDE_Prefs &fdb, const char *name);
Fl_Preferences::ID add_external_lib(Fl_IDE_Prefs &fdb, const char *pathAndName);
};
@@ -94,7 +94,9 @@ public:
const char *fullName();
const char *fileExt();
};
void osx_only(Fl_Preferences::ID id);
#endif
//
+141 -37
View File
@@ -116,7 +116,9 @@ class Xcode3_IDE {
XCID xcBuildConfigurationListID;
XCID xcMainGroupID;
XCID xcProductsGroupID;
XCID xcFilesGroupID;
XCID xcAppsGroupID;
XCID xcLibsGroupID;
XCID xcTestsGroupID;
XCID xcBuildConfigurationDebugID;
XCID xcBuildConfigurationReleaseID;
public:
@@ -137,7 +139,9 @@ public:
getXCID(ideDB, "xcBuildConfigurationListID", xcBuildConfigurationListID);
getXCID(ideDB, "xcMainGroupID", xcMainGroupID);
getXCID(ideDB, "xcProductsGroupID", xcProductsGroupID);
getXCID(ideDB, "xcFilesGroupID", xcFilesGroupID);
getXCID(ideDB, "xcAppsGroupID", xcAppsGroupID);
getXCID(ideDB, "xcLibsGroupID", xcLibsGroupID);
getXCID(ideDB, "xcTestsGroupID", xcTestsGroupID);
getXCID(ideDB, "xcBuildConfigurationDebugID", xcBuildConfigurationDebugID);
getXCID(ideDB, "xcBuildConfigurationReleaseID", xcBuildConfigurationReleaseID);
}
@@ -195,8 +199,8 @@ public:
MAKE_XCID(xcBuildFrameworkID, extDB);
Fl_File_Prefs fileDB(filesDB, refUUID);
MAKE_XCID(xcFileID, fileDB);
const char *name = fileDB.fileName();
fprintf(out, "\t\t%s /* lib%s.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = %s /* lib%s.dylib */; };\n", xcBuildFrameworkID, name, xcFileID, name);
const char *fullName = fileDB.fullName();
fprintf(out, "\t\t%s /* %s in Frameworks */ = {isa = PBXBuildFile; fileRef = %s /* %s */; };\n", xcBuildFrameworkID, fullName, xcFileID, fullName);
}
return 0;
}
@@ -240,6 +244,7 @@ public:
fprintf(out, "\t\t\t);\n");
fprintf(out, "\t\t\tscript = \"export DYLD_FRAMEWORK_PATH=${TARGET_BUILD_DIR} && cd ../../test && ${TARGET_BUILD_DIR}/Fluid.app/Contents/MacOS/Fluid -c ${INPUT_FILE_NAME}\";\n");
fprintf(out, "\t\t};\n");
return 0;
}
/*
@@ -374,7 +379,7 @@ public:
* A list of all files that are somehow referenced in this project
*/
int writeFileReferenceSection(FILE *out) {
int i, j;
int i;
fprintf(out, "/* Begin PBXFileReference section */\n");
// --- list of all Application target results
for (i=0; i<nTgtApps; i++) {
@@ -419,7 +424,8 @@ public:
const char *filetype = "test";
const char *ext = fileDB.fileExt();
if (!ext) {
} else if (strcmp(pathAndName, "src/Fl.cxx")==0) { // FIXME: bad hack!
} else if (strcmp(pathAndName, "src/Fl.cxx")==0
||strcmp(pathAndName, "src/Fl_Native_File_Chooser.cxx")==0) { // FIXME: bad hack!
filetype = "sourcecode.cpp.objcpp";
} else if (strcmp(ext, ".cxx")==0) {
filetype = "sourcecode.cpp.cpp";
@@ -427,13 +433,21 @@ public:
filetype = "sourcecode.c.c";
} else if (strcmp(ext, ".mm")==0) {
filetype = "sourcecode.cpp.objcpp";
} else if (strcmp(ext, ".lib")==0) {
} else if (strcmp(ext, ".dylib")==0) {
fprintf(out,
"\t\t%s /* lib%s.dylib */ = {isa = PBXFileReference; "
"\t\t%s /* %s */ = {isa = PBXFileReference; "
"lastKnownFileType = \"compiled.mach-o.dylib\"; "
"name = lib%s.dylib; path = /usr/lib/libz.dylib; "
"name = %s; path = %s; "
"sourceTree = \"<absolute>\"; };\n",
xcFileID, fileDB.fileName(), fileDB.fileName() );
xcFileID, fullName, fullName, pathAndName );
filetype = 0L;
} else if (strcmp(ext, ".framework")==0) {
fprintf(out,
"\t\t%s /* %s */ = {isa = PBXFileReference; "
"lastKnownFileType = \"wrapper.framework\"; "
"name = %s; path = %s; "
"sourceTree = \"<absolute>\"; };\n",
xcFileID, fullName, fullName, pathAndName );
filetype = 0L;
} else if (strcmp(ext, ".plist")==0) {
filetype = "text.plist.xml";
@@ -510,7 +524,13 @@ public:
*
*/
int writeTargetFiles(FILE *out, Fl_Preferences &targetDB) {
char name[80]; targetDB.get("name", name, "DBERROR", 80);
char name[80];
MAKE_XCID(xcTargetGroupID, targetDB);
targetDB.get("name", name, "DBERROR", 80);
fprintf(out, "\t\t%s /* %s */ = {\n", xcTargetGroupID, name);
fprintf(out, "\t\t\tisa = PBXGroup;\n");
fprintf(out, "\t\t\tchildren = (\n");
MAKE_XCID(xcProductID, targetDB);
Fl_Preferences sourcesDB(targetDB, "sources");
int j, n = sourcesDB.groups();
@@ -539,23 +559,32 @@ public:
GET_UUID(refUUID, extDB);
Fl_File_Prefs fileDB(filesDB, refUUID);
MAKE_XCID(xcFileID, fileDB);
const char *name = fileDB.fileName();
fprintf(out, "\t\t\t\t%s /* lib%s.dylib */,\n", xcFileID, name);
const char *fullName = fileDB.fullName();
fprintf(out, "\t\t\t\t%s /* %s */,\n", xcFileID, fullName);
}
fprintf(out, "\t\t\t);\n");
fprintf(out, "\t\t\tname = %s;\n", name);
fprintf(out, "\t\t\tsourceTree = \"<group>\";\n");
fprintf(out, "\t\t};\n");
return 0;
}
/*
* Groups define the folder hierarchy in the "Groups & Files" panel
*/
int writeGroupSection(FILE *out) {
int i, j;
int i;
char name[80];
fprintf(out, "/* Begin PBXGroup section */\n");
// --- FIXME: missing "icons" group
// --- main group
fprintf(out, "\t\t%s = {\n", xcMainGroupID);
fprintf(out, "\t\t\tisa = PBXGroup;\n");
fprintf(out, "\t\t\tchildren = (\n");
fprintf(out, "\t\t\t\t%s /* Files */,\n", xcFilesGroupID); // link to "Files" group
fprintf(out, "\t\t\t\t%s /* Applications */,\n", xcAppsGroupID);
fprintf(out, "\t\t\t\t%s /* Frameworks */,\n", xcLibsGroupID);
fprintf(out, "\t\t\t\t%s /* Tests */,\n", xcTestsGroupID);
fprintf(out, "\t\t\t\t%s /* Products */,\n", xcProductsGroupID); // link to "Products" group
fprintf(out, "\t\t\t);\n");
fprintf(out, "\t\t\tsourceTree = \"<group>\";\n");
@@ -594,28 +623,63 @@ public:
// --- FIXME: missing "jpeg Sources" group
// --- FIXME: missing "png Sources" group
// --- FIXME: missing "libs" group
// --- "Files" group for testing
fprintf(out, "\t\t%s /* Files */ = {\n", xcFilesGroupID);
// --- "Applications" group for testing
fprintf(out, "\t\t%s /* Applications */ = {\n", xcAppsGroupID);
fprintf(out, "\t\t\tisa = PBXGroup;\n");
fprintf(out, "\t\t\tchildren = (\n");
for (i=0; i<nTgtApps; i++) {
Fl_Preferences targetDB(tgtAppsDB, i);
MAKE_XCID(xcTargetGroupID, targetDB);
targetDB.get("name", name, "DBERROR", 80);
fprintf(out, "\t\t\t\t%s /* %s */,\n", xcTargetGroupID, name);
}
fprintf(out, "\t\t\t);\n");
fprintf(out, "\t\t\tname = Applications;\n");
fprintf(out, "\t\t\tsourceTree = \"<group>\";\n");
fprintf(out, "\t\t};\n");
for (i=0; i<nTgtApps; i++) {
Fl_Preferences targetDB(tgtAppsDB, i);
writeTargetFiles(out, targetDB);
}
// --- "Frameworks" group for testing
fprintf(out, "\t\t%s /* Frameworks */ = {\n", xcLibsGroupID);
fprintf(out, "\t\t\tisa = PBXGroup;\n");
fprintf(out, "\t\t\tchildren = (\n");
for (i=0; i<nTgtLibs; i++) {
Fl_Preferences targetDB(tgtLibsDB, i);
MAKE_XCID(xcTargetGroupID, targetDB);
targetDB.get("name", name, "DBERROR", 80);
fprintf(out, "\t\t\t\t%s /* %s */,\n", xcTargetGroupID, name);
}
fprintf(out, "\t\t\t);\n");
fprintf(out, "\t\t\tname = Frameworks;\n");
fprintf(out, "\t\t\tsourceTree = \"<group>\";\n");
fprintf(out, "\t\t};\n");
for (i=0; i<nTgtLibs; i++) {
Fl_Preferences targetDB(tgtLibsDB, i);
writeTargetFiles(out, targetDB);
}
// --- "Tests" group for testing
fprintf(out, "\t\t%s /* Tests */ = {\n", xcTestsGroupID);
fprintf(out, "\t\t\tisa = PBXGroup;\n");
fprintf(out, "\t\t\tchildren = (\n");
for (i=0; i<nTgtTests; i++) {
Fl_Preferences targetDB(tgtTestsDB, i);
MAKE_XCID(xcTargetGroupID, targetDB);
targetDB.get("name", name, "DBERROR", 80);
fprintf(out, "\t\t\t\t%s /* %s */,\n", xcTargetGroupID, name);
}
fprintf(out, "\t\t\t);\n");
fprintf(out, "\t\t\tname = Tests;\n");
fprintf(out, "\t\t\tsourceTree = \"<group>\";\n");
fprintf(out, "\t\t};\n");
for (i=0; i<nTgtTests; i++) {
Fl_Preferences targetDB(tgtTestsDB, i);
writeTargetFiles(out, targetDB);
}
fprintf(out, "\t\t\t);\n");
fprintf(out, "\t\t\tname = Files;\n");
fprintf(out, "\t\t\tsourceTree = \"<group>\";\n");
fprintf(out, "\t\t};\n");
// --- done
fprintf(out, "/* End PBXGroup section */\n\n");
return 0;
}
@@ -831,7 +895,6 @@ public:
GET_UUID(refUUID, sourceDB);
MAKE_XCID(xcBuildFileID, sourceDB);
Fl_File_Prefs fileDB(filesDB, refUUID);
const char *fullName = fileDB.fullName();
fprintf(out, "\t\t\t\t%s /* %s in Sources */,\n", xcBuildFileID, fileDB.fullName());
}
Fl_Preferences flsDB(targetDB, "fl");
@@ -841,7 +904,6 @@ public:
GET_UUID(refUUID, flDB);
MAKE_XCID(xcBuildFileID, flDB);
Fl_File_Prefs fileDB(filesDB, refUUID);
const char *fullName = fileDB.fullName();
fprintf(out, "\t\t\t\t%s /* %s in Sources */,\n", xcBuildFileID, fileDB.fullName());
}
fprintf(out, "\t\t\t);\n");
@@ -941,7 +1003,7 @@ public:
fprintf(out, "\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n");
fprintf(out, "\t\t\t\tGCC_PFE_FILE_C_DIALECTS = \"c c++\";\n");
fprintf(out, "\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n");
fprintf(out, "\t\t\t\tGCC_PREFIX_HEADER = \"$(SDKROOT)/System/Library/Frameworks/Carbon.framework/Headers/Carbon.h\";\n");
fprintf(out, "\t\t\t\tGCC_PREFIX_HEADER = \"\";\n");
fprintf(out, "\t\t\t\tGCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;\n");
fprintf(out, "\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.2;\n");
fprintf(out, "\t\t\t\tSDKROOT = \"$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk\";\n");
@@ -960,7 +1022,7 @@ public:
fprintf(out, "\t\t\t\tGCC_GENERATE_DEBUGGING_SYMBOLS = NO;\n");
fprintf(out, "\t\t\t\tGCC_PFE_FILE_C_DIALECTS = \"c c++\";\n");
fprintf(out, "\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n");
fprintf(out, "\t\t\t\tGCC_PREFIX_HEADER = \"$(SDKROOT)/System/Library/Frameworks/Carbon.framework/Headers/Carbon.h\";\n");
fprintf(out, "\t\t\t\tGCC_PREFIX_HEADER = \"\";\n");
fprintf(out, "\t\t\t\tGCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;\n");
fprintf(out, "\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.3;\n");
fprintf(out, "\t\t\t\tSDKROOT = \"$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk\";\n");
@@ -988,7 +1050,7 @@ public:
fprintf(out, "\t\t\t\tGCC_MODEL_TUNING = G5;\n");
fprintf(out, "\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n");
fprintf(out, "\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n");
fprintf(out, "\t\t\t\tGCC_PREFIX_HEADER = \"$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h\";\n");
fprintf(out, "\t\t\t\tGCC_PREFIX_HEADER = \"\";\n");
fprintf(out, "\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = \"USING_XCODE=1\";\n");
fprintf(out, "\t\t\t\tHEADER_SEARCH_PATHS = (\n");
fprintf(out, "\t\t\t\t\t../../ide/XCode3/,\n");
@@ -1000,11 +1062,14 @@ public:
fprintf(out, "\t\t\t\tINSTALL_PATH = /Applications;\n");
fprintf(out, "\t\t\t\tOTHER_LDFLAGS = (\n");
fprintf(out, "\t\t\t\t\t\"-framework\",\n");
fprintf(out, "\t\t\t\t\tCocoa,\n");
fprintf(out, "\t\t\t\t\t\"-framework\",\n");
fprintf(out, "\t\t\t\t\tCarbon,\n");
fprintf(out, "\t\t\t\t);\n");
fprintf(out, "\t\t\t\tPREBINDING = NO;\n");
fprintf(out, "\t\t\t\tPRODUCT_NAME = %s;\n", name);
fprintf(out, "\t\t\t\tUSER_HEADER_SEARCH_PATHS = \"\";\n");
fprintf(out, "\t\t\t\tWARNING_CFLAGS = \"-Wno-format-security\";\n");
fprintf(out, "\t\t\t\tWRAPPER_EXTENSION = app;\n");
fprintf(out, "\t\t\t\tZERO_LINK = YES;\n");
fprintf(out, "\t\t\t};\n");
@@ -1019,7 +1084,7 @@ public:
fprintf(out, "\t\t\t\tGCC_ENABLE_FIX_AND_CONTINUE = NO;\n");
fprintf(out, "\t\t\t\tGCC_MODEL_TUNING = G5;\n");
fprintf(out, "\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n");
fprintf(out, "\t\t\t\tGCC_PREFIX_HEADER = \"$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h\";\n");
fprintf(out, "\t\t\t\tGCC_PREFIX_HEADER = \"\";\n");
fprintf(out, "\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = \"USING_XCODE=1\";\n");
fprintf(out, "\t\t\t\tHEADER_SEARCH_PATHS = (\n");
fprintf(out, "\t\t\t\t\t../../ide/XCode3/,\n");
@@ -1031,16 +1096,20 @@ public:
fprintf(out, "\t\t\t\tINSTALL_PATH = /Applications;\n");
fprintf(out, "\t\t\t\tOTHER_LDFLAGS = (\n");
fprintf(out, "\t\t\t\t\t\"-framework\",\n");
fprintf(out, "\t\t\t\t\tCocoa,\n");
fprintf(out, "\t\t\t\t\t\"-framework\",\n");
fprintf(out, "\t\t\t\t\tCarbon,\n");
fprintf(out, "\t\t\t\t);\n");
fprintf(out, "\t\t\t\tPREBINDING = NO;\n");
fprintf(out, "\t\t\t\tPRODUCT_NAME = %s;\n", name);
fprintf(out, "\t\t\t\tUSER_HEADER_SEARCH_PATHS = \"\";\n");
fprintf(out, "\t\t\t\tWARNING_CFLAGS = \"-Wno-format-security\";\n");
fprintf(out, "\t\t\t\tWRAPPER_EXTENSION = app;\n");
fprintf(out, "\t\t\t\tZERO_LINK = NO;\n");
fprintf(out, "\t\t\t};\n");
fprintf(out, "\t\t\tname = Release;\n");
fprintf(out, "\t\t};\n");
return 0;
}
/*
@@ -1073,14 +1142,14 @@ public:
fprintf(out, "\t\t\t\tINSTALL_PATH = \"@executable_path/../Frameworks\";\n");
fprintf(out, "\t\t\t\tOTHER_LDFLAGS = (\n");
fprintf(out, "\t\t\t\t\t\"-framework\",\n");
fprintf(out, "\t\t\t\t\tCarbon,\n");
fprintf(out, "\t\t\t\t\t\"-framework\",\n");
fprintf(out, "\t\t\t\t\tCocoa,\n");
fprintf(out, "\t\t\t\t\t\"-framework\",\n");
fprintf(out, "\t\t\t\t\tCarbon,\n");
fprintf(out, "\t\t\t\t);\n");
fprintf(out, "\t\t\t\tPREBINDING = NO;\n");
fprintf(out, "\t\t\t\tPRODUCT_NAME = %s;\n", name);
fprintf(out, "\t\t\t\tUSER_HEADER_SEARCH_PATHS = \"\";\n");
fprintf(out, "\t\t\t\tWARNING_CFLAGS = \"-Wno-format-nonliteral\";\n");
fprintf(out, "\t\t\t\tWARNING_CFLAGS = \"-Wno-format-security\";\n");
fprintf(out, "\t\t\t\tZERO_LINK = YES;\n");
fprintf(out, "\t\t\t};\n");
fprintf(out, "\t\t\tname = Debug;\n");
@@ -1111,18 +1180,19 @@ public:
fprintf(out, "\t\t\t\tOTHER_LDFLAGS = (\n");
fprintf(out, "\t\t\t\t\"-framework\",\n");
fprintf(out, "\t\t\t\tCocoa,\n");
fprintf(out, "\t\t\t\t\"-framework\",\n");
fprintf(out, "\t\t\t\tCarbon,\n");
fprintf(out, "\t\t\t\t\t\"-framework\",\n");
fprintf(out, "\t\t\t\t\tCarbon,\n");
fprintf(out, "\t\t\t\t);\n");
fprintf(out, "\t\t\t\tPREBINDING = NO;\n");
fprintf(out, "\t\t\t\tPRODUCT_NAME = %s;\n", name);
fprintf(out, "\t\t\t\tSDKROOT = \"\";\n");
fprintf(out, "\t\t\t\tUSER_HEADER_SEARCH_PATHS = \"\";\n");
fprintf(out, "\t\t\t\tWARNING_CFLAGS = \"-Wno-format-nonliteral\";\n");
fprintf(out, "\t\t\t\tWARNING_CFLAGS = \"-Wno-format-security\";\n");
fprintf(out, "\t\t\t\tZERO_LINK = NO;\n");
fprintf(out, "\t\t\t};\n");
fprintf(out, "\t\t\tname = Release;\n");
fprintf(out, "\t\t};\n");
return 0;
}
/*
@@ -1161,6 +1231,7 @@ public:
fprintf(out, "\t\t\tdefaultConfigurationIsVisible = 0;\n");
fprintf(out, "\t\t\tdefaultConfigurationName = Debug;\n");
fprintf(out, "\t\t};\n");
return 0;
}
/*
@@ -1246,8 +1317,36 @@ public:
return 0;
}
int writeConfigH(const char *filepath) {
// FIXME: LATER: do we want to do that?
int writeConfigH(const char *filename) {
FILE *f = fopen(filename, "wb");
fputs("/*\n * \"$Id$\"\n"
" *\n * Configuration file for the Fast Light Tool Kit (FLTK).\n *\n"
" * Copyright 1998-2010 by Bill Spitzak and others.\n */\n\n", f);
fputs("#define FLTK_DATADIR \"/usr/local/share/fltk\"\n"
"#define FLTK_DOCDIR \"/usr/local/share/doc/fltk\"\n"
"#define BORDER_WIDTH 2\n#define HAVE_GL 1\n#define HAVE_GL_GLU_H 1\n"
"#define USE_COLORMAP 1\n#define HAVE_XINERAMA 0\n#define USE_XFT 0\n"
"#define HAVE_XDBE 0\n#define USE_XDBE HAVE_XDBE\n", f);
fputs("#define USE_QUARTZ 1\n#define __APPLE_QUARTZ__ 1\n"
"#define __APPLE_COCOA__ 1\n#define HAVE_OVERLAY 0\n"
"#define HAVE_GL_OVERLAY HAVE_OVERLAY\n#define WORDS_BIGENDIAN 0\n"
"#define U16 unsigned short\n#define U32 unsigned\n"
"#define HAVE_DIRENT_H 1\n#define HAVE_SCANDIR 1\n"
"#define HAVE_VSNPRINTF 1\n", f);
fputs("#define HAVE_SNPRINTF 1\n#define HAVE_STRINGS_H 1\n"
"#define HAVE_STRCASECMP 1\n#define HAVE_STRLCAT 1\n"
"#define HAVE_STRLCPY 1\n#define HAVE_LOCALE_H 1\n"
"#define HAVE_LOCALECONV 1\n#define HAVE_SYS_SELECT_H 1\n"
"#define USE_POLL 0\n#define HAVE_LIBPNG 1\n#define HAVE_LIBZ 1\n"
"#define HAVE_LIBJPEG 1\n#define HAVE_PNG_H 1\n", f);
fputs("#define HAVE_PTHREAD 1\n#define HAVE_PTHREAD_H 1\n"
"#define HAVE_LONG_LONG 1\n#define FLTK_LLFMT \"%lld\"\n"
"#define FLTK_LLCAST (long long)\n#define HAVE_STRTOLL 1\n"
"#define HAVE_DLFCN_H 1\n#define HAVE_DLSYM 1\n\n", f);
fputs("/*\n"
" * End of \"$Id$\".\n"
" */", f);
fclose(f);
return 0;
}
@@ -1322,7 +1421,8 @@ public:
// --- create project.pbxproj
sprintf(filepath, "%s/ide/Xcode3/FLTK.xcodeproj", rootDir); fl_mkdir(filepath, 0777);
writeProjectFile(filepath);
// --- FIXME: LATER: should we create config.h here?
// --- create a valid config.h
sprintf(filepath, "%s/ide/Xcode3/config.h", rootDir);
writeConfigH(filepath);
// --- FIXME: LATER: create default icons (maybe import icons for apps?)
sprintf(filepath, "%s/ide/Xcode3/icons", rootDir); fl_mkdir(filepath, 0777);
@@ -1377,6 +1477,10 @@ public:
}
return 0;
}
int test(const char *a1, const char *a2, const char *a3) {
generate_fltk_Xcode3_support(a1, a2);
return 0;
}
};
Fl_IDE_Xcode_Plugin IDE_Xcode_Plugin;
+1 -1
View File
@@ -60,7 +60,7 @@ int Fl_Button::value(int v) {
*/
void Fl_Button::setonly() { // set this radio button on, turn others off
value(1);
Fl_Group* g = (Fl_Group*)parent();
Fl_Group* g = parent();
Fl_Widget*const* a = g->array();
for (int i = g->children(); i--;) {
Fl_Widget* o = *a++;
+2 -2
View File
@@ -77,7 +77,7 @@ void Fl_Group::begin() {current_ = this;}
<I>Exactly the same as</I> current(this->parent()). Any new widgets
added to the widget tree will be added to the parent of the group.
*/
void Fl_Group::end() {current_ = (Fl_Group*)parent();}
void Fl_Group::end() {current_ = parent();}
/**
Returns the currently active group.
@@ -429,7 +429,7 @@ Fl_Group::~Fl_Group() {
*/
void Fl_Group::insert(Fl_Widget &o, int index) {
if (o.parent()) {
Fl_Group* g = (Fl_Group*)(o.parent());
Fl_Group* g = o.parent();
int n = g->find(o);
if (g == this) {
if (index > n) index--;
+101 -54
View File
@@ -466,7 +466,7 @@ char Fl_Preferences::deleteAllGroups()
*/
int Fl_Preferences::entries()
{
return node->nEntry;
return node->nEntry();
}
@@ -480,7 +480,7 @@ int Fl_Preferences::entries()
*/
const char *Fl_Preferences::entry( int index )
{
return node->entry[index].name;
return node->entry(index).name;
}
@@ -1350,10 +1350,13 @@ Fl_Preferences::Node::Node( const char *path )
{
if ( path ) path_ = strdup( path ); else path_ = 0;
child_ = 0; next_ = 0; parent_ = 0;
entry = 0;
nEntry = NEntry = 0;
entry_ = 0;
nEntry_ = NEntry_ = 0;
dirty_ = 0;
top_ = 0;
indexed_ = 0;
index_ = 0;
nIndex_ = NIndex_ = 0;
}
void Fl_Preferences::Node::deleteAllChildren()
@@ -1366,27 +1369,28 @@ void Fl_Preferences::Node::deleteAllChildren()
}
child_ = 0L;
dirty_ = 1;
updateIndex();
}
void Fl_Preferences::Node::deleteAllEntries()
{
if ( entry )
if ( entry_ )
{
for ( int i = 0; i < nEntry; i++ )
for ( int i = 0; i < nEntry_; i++ )
{
if ( entry[i].name ) {
free( entry[i].name );
entry[i].name = 0L;
if ( entry_[i].name ) {
free( entry_[i].name );
entry_[i].name = 0L;
}
if ( entry[i].value ) {
free( entry[i].value );
entry[i].value = 0L;
if ( entry_[i].value ) {
free( entry_[i].value );
entry_[i].value = 0L;
}
}
free( entry );
entry = 0L;
nEntry = 0;
NEntry = 0;
free( entry_ );
entry_ = 0L;
nEntry_ = 0;
NEntry_ = 0;
}
dirty_ = 1;
}
@@ -1396,6 +1400,7 @@ Fl_Preferences::Node::~Node()
{
deleteAllChildren();
deleteAllEntries();
deleteIndex();
if ( path_ ) {
free( path_ );
path_ = 0L;
@@ -1420,12 +1425,12 @@ int Fl_Preferences::Node::write( FILE *f )
{
if ( next_ ) next_->write( f );
fprintf( f, "\n[%s]\n\n", path_ );
for ( int i = 0; i < nEntry; i++ )
for ( int i = 0; i < nEntry_; i++ )
{
char *src = entry[i].value;
char *src = entry_[i].value;
if ( src )
{ // hack it into smaller pieces if needed
fprintf( f, "%s:", entry[i].name );
fprintf( f, "%s:", entry_[i].name );
int cnt;
for ( cnt = 0; cnt < 60; cnt++ )
if ( src[cnt]==0 ) break;
@@ -1443,7 +1448,7 @@ int Fl_Preferences::Node::write( FILE *f )
}
}
else
fprintf( f, "%s\n", entry[i].name );
fprintf( f, "%s\n", entry_[i].name );
}
if ( child_ ) child_->write( f );
dirty_ = 0;
@@ -1482,37 +1487,38 @@ Fl_Preferences::Node *Fl_Preferences::Node::addChild( const char *path )
Node *nd = find( name );
free( name );
dirty_ = 1;
updateIndex();
return nd;
}
// create and set, or change an entry within this node
void Fl_Preferences::Node::set( const char *name, const char *value )
{
for ( int i=0; i<nEntry; i++ )
for ( int i=0; i<nEntry_; i++ )
{
if ( strcmp( name, entry[i].name ) == 0 )
if ( strcmp( name, entry_[i].name ) == 0 )
{
if ( !value ) return; // annotation
if ( strcmp( value, entry[i].value ) != 0 )
if ( strcmp( value, entry_[i].value ) != 0 )
{
if ( entry[i].value )
free( entry[i].value );
entry[i].value = strdup( value );
if ( entry_[i].value )
free( entry_[i].value );
entry_[i].value = strdup( value );
dirty_ = 1;
}
lastEntrySet = i;
return;
}
}
if ( NEntry==nEntry )
if ( NEntry_==nEntry_ )
{
NEntry = NEntry ? NEntry*2 : 10;
entry = (Entry*)realloc( entry, NEntry * sizeof(Entry) );
NEntry_ = NEntry_ ? NEntry_*2 : 10;
entry_ = (Entry*)realloc( entry_, NEntry_ * sizeof(Entry) );
}
entry[ nEntry ].name = strdup( name );
entry[ nEntry ].value = value?strdup( value ):0;
lastEntrySet = nEntry;
nEntry++;
entry_[ nEntry_ ].name = strdup( name );
entry_[ nEntry_ ].value = value?strdup( value ):0;
lastEntrySet = nEntry_;
nEntry_++;
dirty_ = 1;
}
@@ -1546,8 +1552,8 @@ void Fl_Preferences::Node::set( const char *line )
// add more data to an existing entry
void Fl_Preferences::Node::add( const char *line )
{
if ( lastEntrySet<0 || lastEntrySet>=nEntry ) return;
char *&dst = entry[ lastEntrySet ].value;
if ( lastEntrySet<0 || lastEntrySet>=nEntry_ ) return;
char *&dst = entry_[ lastEntrySet ].value;
int a = strlen( dst );
int b = strlen( line );
dst = (char*)realloc( dst, a+b+1 );
@@ -1559,15 +1565,15 @@ void Fl_Preferences::Node::add( const char *line )
const char *Fl_Preferences::Node::get( const char *name )
{
int i = getEntry( name );
return i>=0 ? entry[i].value : 0 ;
return i>=0 ? entry_[i].value : 0 ;
}
// find the index of an entry, returns -1 if no such entry
int Fl_Preferences::Node::getEntry( const char *name )
{
for ( int i=0; i<nEntry; i++ )
for ( int i=0; i<nEntry_; i++ )
{
if ( strcmp( name, entry[i].name ) == 0 )
if ( strcmp( name, entry_[i].name ) == 0 )
{
return i;
}
@@ -1580,8 +1586,8 @@ char Fl_Preferences::Node::deleteEntry( const char *name )
{
int ix = getEntry( name );
if ( ix == -1 ) return 0;
memmove( entry+ix, entry+ix+1, (nEntry-ix-1) * sizeof(Entry) );
nEntry--;
memmove( entry_+ix, entry_+ix+1, (nEntry_-ix-1) * sizeof(Entry) );
nEntry_--;
dirty_ = 1;
return 1;
}
@@ -1670,10 +1676,14 @@ Fl_Preferences::Node *Fl_Preferences::Node::search( const char *path, int offset
// return the number of child nodes (groups)
int Fl_Preferences::Node::nChildren()
{
int cnt = 0;
for ( Node *nd = child_; nd; nd = nd->next_ )
cnt++;
return cnt;
if (indexed_) {
return nIndex_;
} else {
int cnt = 0;
for ( Node *nd = child_; nd; nd = nd->next_ )
cnt++;
return cnt;
}
}
// return the node name
@@ -1688,7 +1698,7 @@ const char *Fl_Preferences::Node::name()
}
}
// return the n'th child node
// return the n'th child node's name
const char *Fl_Preferences::Node::child( int ix )
{
Node *nd = childNode( ix );
@@ -1701,13 +1711,22 @@ const char *Fl_Preferences::Node::child( int ix )
// return the n'th child node
Fl_Preferences::Node *Fl_Preferences::Node::childNode( int ix )
{
Node *nd;
for ( nd = child_; nd; nd = nd->next_ )
{
if ( !ix-- ) break;
if ( !nd ) break;
createIndex();
if (indexed_) {
// usually faster access in correct order, but needing more memory
return index_[ix];
} else {
// slow access and reverse order
int n = nChildren();
ix = n - ix -1;
Node *nd;
for ( nd = child_; nd; nd = nd->next_ )
{
if ( !ix-- ) break;
if ( !nd ) break;
}
return nd;
}
return nd;
}
// remove myself from the list and delete me (and all children)
@@ -1729,11 +1748,39 @@ char Fl_Preferences::Node::remove()
}
}
parent()->dirty_ = 1;
parent()->updateIndex();
}
delete this;
return ( nd != 0 );
}
void Fl_Preferences::Node::createIndex() {
if (indexed_) return;
int n = nChildren();
if (n>NIndex_) {
NIndex_ = n + 16;
index_ = (Node**)realloc(index_, NIndex_*sizeof(Node**));
}
Node *nd;
int i = 0;
for (nd = child_; nd; nd = nd->next_, i++) {
index_[n-i-1] = nd;
}
nIndex_ = n;
indexed_ = 1;
}
void Fl_Preferences::Node::updateIndex() {
indexed_ = 0;
}
void Fl_Preferences::Node::deleteIndex() {
if (index_) free(index_);
NIndex_ = nIndex_ = 0;
index_ = 0;
indexed_ = 0;
}
char Fl_Preferences::Node::copyTo(Fl_Tree *tree, Fl_Tree_Item *ti)
{
ti->label(name());
@@ -1744,11 +1791,11 @@ char Fl_Preferences::Node::copyTo(Fl_Tree *tree, Fl_Tree_Item *ti)
nd->copyTo(tree, tic);
tic->close();
}
int i, n = nEntry;
int i, n = nEntry_;
for (i=0; i<n; i++) {
char buf[80];
const char *name = entry[i].name;
const char *value = entry[i].value;
const char *name = entry_[i].name;
const char *value = entry_[i].value;
fl_snprintf(buf, 80, "%s: %s", name, value);
tree->add(ti, buf);
}
+1 -1
View File
@@ -15,7 +15,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+1 -1
View File
@@ -126,7 +126,7 @@ Fl_Value_Input::Fl_Value_Input(int X, int Y, int W, int H, const char* l)
: Fl_Valuator(X, Y, W, H, l), input(X, Y, W, H, 0) {
soft_ = 0;
if (input.parent()) // defeat automatic-add
((Fl_Group*)input.parent())->remove(input);
input.parent()->remove(input);
input.parent((Fl_Group *)this); // kludge!
input.callback(input_cb, this);
input.when(FL_WHEN_CHANGED);
+42 -1
View File
@@ -38,6 +38,47 @@
// One Compile to copy them all and in the bundle bind them,
// in the Land of MacOS X where the Drop-Shadows lie."
/*
TODO: The following messages point to the last Carbon remainders. We should
really remove these as well, so we can stop linking to Carbon alltogether.
"_GetKeys", referenced from:
Fl::get_key(int) in Fl_get_key.o
"_GetCurrentEventQueue", referenced from:
do_queued_events(double)in Fl.o
"_InstallEventLoopTimer", referenced from:
Fl::add_timeout(double, void (*)(void*), void*)in Fl.o
"_FlushEvents", referenced from:
fl_open_display() in Fl.o
"_GetEventParameter", referenced from:
carbonTextHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) in Fl.o
"_InstallEventHandler", referenced from:
fl_open_display() in Fl.o
"_GetEventDispatcherTarget", referenced from:
fl_open_display() in Fl.o
"_SetEventLoopTimerNextFireTime", referenced from:
Fl::add_timeout(double, void (*)(void*), void*)in Fl.o
"_RemoveEventLoopTimer", referenced from:
Fl::add_timeout(double, void (*)(void*), void*)in Fl.o
delete_timer(MacTimeout&) in Fl.o
"_GetMainEventLoop", referenced from:
Fl::add_timeout(double, void (*)(void*), void*)in Fl.o
"_GetCurrentKeyModifiers", referenced from:
-[FLView flagsChanged:] in Fl.o
*/
// we don't need the following definition because we deliver only
// true mouse moves. On very slow systems however, this flag may
// still be useful.
@@ -1918,7 +1959,7 @@ static void q_set_window_title(NSWindow *nsw, const char * name ) {
if ( Fl::e_keysym )
sendEvent = ( prevMods<mods ) ? FL_KEYBOARD : FL_KEYUP;
Fl::e_length = 0;
Fl::e_text = "";
Fl::e_text = (char*)"";
prevMods = mods;
}
mods_to_e_state( mods );
+109 -5
View File
@@ -25,6 +25,104 @@
// http://www.fltk.org/str.php
//
const char *default_menu[] = {
"# Menu description file for the generic demo program\n",
"#\n",
"# Each line consists of three fields, separated by :\n",
"#\n",
"# - menu name : To which the item belongs (starts with @)\n",
"# - item name : Placed on button. (use \\n for newline)\n",
"# - command name: To be executed. Use a menu name to define a submenu.\n",
"#\n",
"# @main indicates the main menu.\n",
"#\n",
"\n",
"@main:Widget\\nTests:@x\n",
"@x:Fl_Browser:browser\n",
"@x:Fl_Input:input\n",
"@x:Fl_Output:output\n",
"@x:Fl_Button:radio\n",
"@x:Fl_Tabs:tabs\n",
"@x:Fl_Tile:tile\n",
"@x:Fl_Scroll:scroll\n",
"@x:Fl_Pack:pack\n",
"@x:more...:@xm\n",
"@xm:Fl_Menu:menubar\n",
"@xm:Fl_Table:table\n",
"@xm:Fl_Tree:tree\n",
"\n",
"@main:Window\\nTests:@w\n",
"@w:overlay:overlay\n",
"@w:subwindow:subwindow\n",
"@w:double\\nbuffer:doublebuffer\n",
"@w:GL window:cube\n",
"@w:GL overlay:gl_overlay\n",
"@w:iconize:iconize\n",
"@w:fullscreen:fullscreen\n",
"@w:resizable:resizebox\n",
"@w:resize:resize\n",
"\n",
"@main:Drawing\\nTests:@d\n",
"@d:Images:@di\n",
"@di:Fl_Bitmap:bitmap\n",
"@di:Fl_Pixmap:pixmap\n",
"@di:Fl_RGB\\n_Image:image\n",
"@di:Fl_Shared\\n_Image:pixmap_browser\n",
"@di:Fl_Tiled\\n_Image:tiled_image\n",
"@d:cursor:cursor\n",
"@d:labels:label\n",
"@d:fl_arc:arc\n",
"@d:fl_curve:curve\n",
"@d:fl_line_style:line_style\n",
"\n",
"@main:Events:@u\n",
"@u:navigation:navigation\n",
"@u:minimum update:minimum\n",
"@u:keyboard:keyboard\n",
"@u:fast && slow widgets:fast_slow\n",
"@u:inactive:inactive\n",
"\n",
"@main:Fluid\\n(UI design tool):../fluid/fluid valuators.fl\n",
"\n",
"@main:Cool\\nDemos:@e\n",
"@e:X Color\\nBrowser:colbrowser\n",
"@e:Mandelbrot:mandelbrot\n",
"@e:Fractals:fractals\n",
"@e:Puzzle:glpuzzle\n",
"@e:Block\\nAttack!:blocks\n",
"@e:Checkers:checkers\n",
"@e:Sudoku:sudoku\n",
"\n",
"@main:Other\\nTests:@o\n",
"@o:Color Choosers:color_chooser\n",
"@o:File Chooser:file_chooser\n",
"@o:Native File Chooser:native-filechooser\n",
"@o:Font Tests:@of\n",
"@of:Fonts:fonts\n",
"@of:UTF-8:utf8\n",
"@o:HelpDialog:help\n",
"@o:Input Choice:input_choice\n",
"@o:Preferences:preferences\n",
"@o:Threading:threads\n",
"@o:XForms Emulation:forms\n",
"\n",
"@main:Tutorial\\nfrom\\nManual:@j\n",
"@j:ask\\n(modified):ask\n",
"@j:button:button\n",
"@j:CubeView:CubeView\n",
"@j:editor:editor editor.cxx\n",
"@j:hello:hello\n",
"@j:shape:shape\n",
"\n",
"@main:Images\\nfor\\nManual:@i\n",
"@i:valuators:valuators\n",
"@i:symbols:symbols\n",
"@i:buttons:buttons\n",
"@i:clock:clock\n",
"@i:popups:message\n",
"@i:boxtypes:boxtype\n",
0 };
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -316,9 +414,9 @@ void doexit(Fl_Widget *, void *) {exit(0);}
int load_the_menu(const char* fname)
/* Loads the menu file. Returns whether successful. */
{
FILE *fin;
FILE *fin = 0;
char line[256], mname[64],iname[64],cname[64];
int i,j;
int i,j, mi = 0;
fin = fopen(fname,"r");
if (fin == NULL)
{
@@ -333,10 +431,15 @@ int load_the_menu(const char* fname)
fin = fopen(fname,"r");
if (fin == NULL)
#endif
return 0;
}
for (;;) {
if (fgets(line,256,fin) == NULL) break;
if (fin) {
if (fgets(line,256,fin) == NULL) break;
} else {
const char *m = default_menu[mi++];
if (!m) break;
strcpy(line, m);
}
// remove all carriage returns that Cygwin may have inserted
char *s = line, *d = line;
for (;;++d) {
@@ -370,7 +473,8 @@ int load_the_menu(const char* fname)
cname[j] = '\0';
addto_menu(mname,iname,cname);
}
fclose(fin);
if (fin)
fclose(fin);
return 1;
}