Added text constants for preference names (project and application) for

easier testing (removed duplicated strings).


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9229 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser
2012-01-18 15:15:04 +00:00
parent 92d846caa4
commit 82b6725d16
+12 -6
View File
@@ -23,6 +23,12 @@ decl {void readPrefs();} {public local
decl {void writePrefs();} {public local decl {void writePrefs();} {public local
} }
decl {const char *project = "fltk.org";} {private local
}
decl {const char *application = "test/preferences";} {private local
}
Function {closeWindowCB( Fl_Widget*, void* )} {open private return_type void Function {closeWindowCB( Fl_Widget*, void* )} {open private return_type void
} { } {
code {Fl::delete_widget(myWindow);} {} code {Fl::delete_widget(myWindow);} {}
@@ -39,7 +45,7 @@ Function {} {open return_type int
Fl_Window myWindow { Fl_Window myWindow {
label {My Preferences} label {My Preferences}
callback closeWindowCB open callback closeWindowCB open
xywh {394 64 298 311} type Double visible xywh {709 76 298 311} type Double visible
} { } {
Fl_Button {} { Fl_Button {} {
label Cancel label Cancel
@@ -195,7 +201,7 @@ int intValue;
char buffer[80]; char buffer[80];
double doubleValue; double doubleValue;
Fl_Preferences app( Fl_Preferences::USER, "fltk.org", "test/preferences" ); Fl_Preferences app( Fl_Preferences::USER, project, application );
char path[ FL_PATH_MAX ]; char path[ FL_PATH_MAX ];
app.getUserdataPath( path, sizeof(path) ); app.getUserdataPath( path, sizeof(path) );
@@ -262,12 +268,13 @@ Fl_Preferences app( Fl_Preferences::USER, "fltk.org", "test/preferences" );
eat.get( "binFoo", (void*)&hex, 0, 0, sizeof( unsigned int ) ); eat.get( "binFoo", (void*)&hex, 0, 0, sizeof( unsigned int ) );
void *data; void *data;
eat.get( "binFoo2", data, 0, 0 ); eat.get( "binFoo2", data, 0, 0 );
**/} {} **/} {selected
}
} }
Function {writePrefs()} {open return_type void Function {writePrefs()} {open return_type void
} { } {
code {Fl_Preferences app( Fl_Preferences::USER, "fltk.org", "test/preferences" ); code {Fl_Preferences app( Fl_Preferences::USER, project, application );
Fl_Preferences bed( app, "Bed" ); Fl_Preferences bed( app, "Bed" );
@@ -323,6 +330,5 @@ Function {writePrefs()} {open return_type void
/* sample code only: */ /* sample code only: */
unsigned int hex = 0x2387efcd; unsigned int hex = 0x2387efcd;
eat.set( "binFoo", (void*)&hex, sizeof( unsigned int ) ); eat.set( "binFoo", (void*)&hex, sizeof( unsigned int ) );
eat.set( "binFoo2", (void*)&bed, 256 );} {selected eat.set( "binFoo2", (void*)&bed, 256 );} {}
}
} }