Change colbrowser to btter conform to FLTK coding standards. For OS X bundle format, move the RGB file into the bundel.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8166 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
4be4baed6b
commit
5f2aa6ca9c
@ -655,6 +655,7 @@
|
||||
C9EDD4ED1274BBCD00ADB21C /* forms.H in CopyFiles */ = {isa = PBXBuildFile; fileRef = E0132688B22159A85307F264 /* forms.H */; };
|
||||
C9EDD5531274C04500ADB21C /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05376DC900B2C885B847EA36 /* OpenGL.framework */; };
|
||||
C9EDD5B31274C51600ADB21C /* Fl_PostScript.H in CopyFiles */ = {isa = PBXBuildFile; fileRef = C9EDD5B11274C4FA00ADB21C /* Fl_PostScript.H */; };
|
||||
C9F9C0DE12CFCDAC0067ADCC /* rgb.txt in Resources */ = {isa = PBXBuildFile; fileRef = C9F9C0DD12CFCDAC0067ADCC /* rgb.txt */; };
|
||||
CA035B0265710EFABD6E632D /* Fl_Dial.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 3AFC31503AB99F6D00BAC647 /* Fl_Dial.cxx */; };
|
||||
CAA4C60E679571629681FAC8 /* fltk.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = FEB0F8FE6383384180570D94 /* fltk.framework */; };
|
||||
CAF6CE97B3EBEFFA65AAEEAD /* Fl_Widget.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 0B9D4355B2E878715DD43AD3 /* Fl_Widget.cxx */; };
|
||||
@ -4484,6 +4485,7 @@
|
||||
C9EDD4E61274BBB600ADB21C /* jpeglib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jpeglib.h; path = ../../jpeg/jpeglib.h; sourceTree = SOURCE_ROOT; };
|
||||
C9EDD5B11274C4FA00ADB21C /* Fl_PostScript.H */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Fl_PostScript.H; path = ../../FL/Fl_PostScript.H; sourceTree = SOURCE_ROOT; };
|
||||
C9F1464F0E6A4DCD77AF72B8 /* Fl_Function_Type.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Function_Type.cxx; path = ../../fluid/Fl_Function_Type.cxx; sourceTree = SOURCE_ROOT; };
|
||||
C9F9C0DD12CFCDAC0067ADCC /* rgb.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = rgb.txt; path = ../../test/rgb.txt; sourceTree = SOURCE_ROOT; };
|
||||
CAEC632CEFC2CA7592EF9D74 /* image.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = image.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
CB23A4CE90D5A89FA2640A78 /* label.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = label.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
CC0C80DA4DD31B6B2DB91096 /* CodeEditor.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CodeEditor.cxx; path = ../../fluid/CodeEditor.cxx; sourceTree = SOURCE_ROOT; };
|
||||
@ -5647,6 +5649,7 @@
|
||||
2000E0C1AD91ACA63811D339 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C9F9C0DD12CFCDAC0067ADCC /* rgb.txt */,
|
||||
C9EDD143127338F600ADB21C /* README.OSX.txt */,
|
||||
5D444464FCF5714805936107 /* Applications */,
|
||||
188555DBC553F66588792C6B /* Frameworks */,
|
||||
@ -8525,6 +8528,7 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C9F9C0DE12CFCDAC0067ADCC /* rgb.txt in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
// http://www.fltk.org/str.php
|
||||
//
|
||||
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Double_Window.H>
|
||||
#include <FL/Fl_Button.H>
|
||||
@ -39,6 +40,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
// some constants
|
||||
|
||||
#define MAX_RGB 3000
|
||||
@ -46,6 +48,7 @@
|
||||
#define FL_FREE_COL4 ((Fl_Color)(FL_FREE_COLOR+3))
|
||||
#define FL_INDIANRED ((Fl_Color)(164))
|
||||
|
||||
|
||||
static Fl_Double_Window *cl;
|
||||
static Fl_Box *rescol;
|
||||
static Fl_Button *dbobj;
|
||||
@ -61,13 +64,19 @@ typedef struct { int r, g, b; } RGBdb;
|
||||
|
||||
static RGBdb rgbdb[MAX_RGB];
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Fl::args(argc, argv);
|
||||
|
||||
create_form_cl();
|
||||
|
||||
#ifdef USING_XCODE
|
||||
strcpy(dbname, "../../../../../../../test/rgb.txt");
|
||||
// Xcode apps do not set the current directory
|
||||
strcpy(dbname, argv[0]);
|
||||
char *slash = strrchr(dbname, '/');
|
||||
if (slash)
|
||||
strcpy(slash, "/../Resources/rgb.txt");
|
||||
#else
|
||||
strcpy(dbname, "rgb.txt");
|
||||
#endif
|
||||
@ -87,8 +96,8 @@ main(int argc, char *argv[])
|
||||
return Fl::run();
|
||||
}
|
||||
|
||||
static void
|
||||
set_entry(int i)
|
||||
|
||||
static void set_entry(int i)
|
||||
{
|
||||
RGBdb *db = rgbdb + i;
|
||||
Fl::set_color(FL_FREE_COL4, db->r, db->g, db->b);
|
||||
@ -98,8 +107,8 @@ set_entry(int i)
|
||||
rescol->redraw();
|
||||
}
|
||||
|
||||
static void
|
||||
br_cb(Fl_Widget *ob, long)
|
||||
|
||||
static void br_cb(Fl_Widget *ob, long)
|
||||
{
|
||||
int r = ((Fl_Browser *)ob)->value();
|
||||
|
||||
@ -108,8 +117,8 @@ br_cb(Fl_Widget *ob, long)
|
||||
set_entry(r - 1);
|
||||
}
|
||||
|
||||
static int
|
||||
read_entry(FILE * fp, int *r, int *g, int *b, char *name)
|
||||
|
||||
static int read_entry(FILE * fp, int *r, int *g, int *b, char *name)
|
||||
{
|
||||
int n;
|
||||
char buf[512], *p;
|
||||
@ -141,8 +150,7 @@ read_entry(FILE * fp, int *r, int *g, int *b, char *name)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
load_browser(char *fname)
|
||||
static int load_browser(char *fname)
|
||||
{
|
||||
FILE *fp;
|
||||
RGBdb *db = rgbdb, *dbs = db + MAX_RGB;
|
||||
@ -194,8 +202,8 @@ load_browser(char *fname)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
search_entry(int r, int g, int b)
|
||||
|
||||
static int search_entry(int r, int g, int b)
|
||||
{
|
||||
register RGBdb *db = rgbdb;
|
||||
int i, j, diffr, diffg, diffb;
|
||||
@ -211,7 +219,7 @@ search_entry(int r, int g, int b)
|
||||
#ifdef FL_LINEAR
|
||||
diff = unsigned(3.0 * (FL_abs(r - db->r)) +
|
||||
(5.9 * FL_abs(g - db->g)) +
|
||||
(1.1 * (FL_abs(b - db->b)));
|
||||
(1.1 * (FL_abs(b - db->b))));
|
||||
#else
|
||||
diff = unsigned(3.0 * (diffr *diffr) +
|
||||
5.9 * (diffg *diffg) +
|
||||
@ -228,8 +236,8 @@ search_entry(int r, int g, int b)
|
||||
return j;
|
||||
}
|
||||
|
||||
static void
|
||||
search_rgb(Fl_Widget *, long)
|
||||
|
||||
static void search_rgb(Fl_Widget *, long)
|
||||
{
|
||||
int r, g, b, i;
|
||||
int top = colbr->topline();
|
||||
@ -249,9 +257,9 @@ search_rgb(Fl_Widget *, long)
|
||||
// fl_unfreeze_form(cl);
|
||||
}
|
||||
|
||||
|
||||
/* change database */
|
||||
static void
|
||||
db_cb(Fl_Widget * ob, long)
|
||||
static void db_cb(Fl_Widget * ob, long)
|
||||
{
|
||||
const char *p = fl_input("Enter New Database Name", dbname);
|
||||
char buf[512];
|
||||
@ -266,14 +274,14 @@ db_cb(Fl_Widget * ob, long)
|
||||
ob->label(dbname);
|
||||
}
|
||||
|
||||
static void
|
||||
done_cb(Fl_Widget *, long)
|
||||
|
||||
static void done_cb(Fl_Widget *, long)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void
|
||||
create_form_cl(void)
|
||||
|
||||
static void create_form_cl(void)
|
||||
{
|
||||
if (cl)
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user