diff --git a/api/boinc_api.C b/api/boinc_api.C index 2da988f529..f7a5feeddd 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -79,18 +79,13 @@ bool boinc_is_standalone() { return standalone; } -// read the INIT_DATA and FD_INIT files +// parse the init data file. +// This is done at startup, and also if a "reread prefs" message is received // -int boinc_init(bool standalone_ /* = false */) { +int boinc_parse_init_data_file() { FILE* f; int retval; -#ifdef _WIN32 - freopen(STDERR_FILE, "a", stderr); -#endif - - standalone = standalone_; - // If in standalone mode, use init files if they're there, // but don't demand that they exist // @@ -119,6 +114,23 @@ int boinc_init(bool standalone_ /* = false */) { return retval; } } + return 0; +} + +// read the INIT_DATA and FD_INIT files +// +int boinc_init(bool standalone_ /* = false */) { + FILE* f; + int retval; + +#ifdef _WIN32 + freopen(STDERR_FILE, "a", stderr); +#endif + + standalone = standalone_; + + retval = boinc_parse_init_data_file(); + if (retval) return retval; f = fopen(FD_INIT_FILE, "r"); if (f) { diff --git a/api/boinc_api.h b/api/boinc_api.h index c9af1da16d..dea7a2d704 100755 --- a/api/boinc_api.h +++ b/api/boinc_api.h @@ -55,6 +55,7 @@ public: }; int boinc_init(bool standalone = false); +int boinc_parse_init_data_file(); int boinc_get_init_data(APP_INIT_DATA&); int boinc_finish(int); int boinc_resolve_filename(const char*, char*, int len); diff --git a/api/graphics_api.C b/api/graphics_api.C index 825edeb808..c2a654d99d 100755 --- a/api/graphics_api.C +++ b/api/graphics_api.C @@ -56,7 +56,7 @@ HANDLE hQuitEvent; GRAPHICS_INFO gi; bool graphics_inited = false; -int boinc_init_opengl() { +int boinc_init_graphics() { #ifdef HAVE_GL_LIB FILE* f; int retval; @@ -149,7 +149,7 @@ int boinc_init_opengl() { return !graphics_inited; } -int boinc_finish_opengl() { +int boinc_finish_graphics() { #ifdef _WIN32 if (graphics_inited) { win_loop_done = TRUE; @@ -205,7 +205,7 @@ bool throttled_app_render(int x, int y, double t) { if (boinc_max_gfx_cpu_frac) { boinc_cpu_time(t0, m); } - app_render(x, y, t); + app_graphics_render(x, y, t); if (boinc_max_gfx_cpu_frac) { boinc_cpu_time(t1, m); total_render_time += t1 - t0; @@ -257,7 +257,7 @@ GLenum ReSizeGLScene(GLsizei width, GLsizei height) { err = glGetError(); if (err) return err; - app_resize(width,height); + app_graphics_resize(width,height); return GL_NO_ERROR; } #endif diff --git a/api/graphics_api.h b/api/graphics_api.h index 2c6637d352..c31089b7c8 100755 --- a/api/graphics_api.h +++ b/api/graphics_api.h @@ -73,8 +73,8 @@ #endif // The API (functions called by the app) -extern int boinc_init_opengl(); -extern int boinc_finish_opengl(); +extern int boinc_init_graphics(); +extern int boinc_finish_graphics(); #ifdef HAVE_GL_LIB extern GLvoid glPrint(GLuint font, const char *fmt, ...); @@ -82,9 +82,14 @@ extern GLvoid glPrint(GLuint font, const char *fmt, ...); // Functions that must be supplied by the app // -extern void app_render(int xs, int ys, double time_of_day); -extern void app_init_gl(); -extern void app_resize(int width, int height); +extern void app_graphics_render(int xs, int ys, double time_of_day); +extern void app_graphics_init(); + // called each time a window is opened; + // called in the graphics thread +extern void app_graphics_reread_prefs(); + // called when get REREAD_PREFS message from core client. + // called in the graphics thread +extern void app_graphics_resize(int width, int height); // Implementation stuff // diff --git a/api/gutil.C b/api/gutil.C index 02a4e62b00..07108ee71b 100755 --- a/api/gutil.C +++ b/api/gutil.C @@ -710,7 +710,7 @@ void MOVING_TEXT_PANEL::sort(MOVING_TEXT_PANEL* tp, int n) { qsort(tp, n, sizeof(MOVING_TEXT_PANEL), compare_tp); } -PROGRESS::PROGRESS( +void PROGRESS::init( GLfloat* p, GLfloat l, GLfloat r, GLfloat in, GLfloat* c, GLfloat* ic ) { memcpy(pos, p, sizeof(pos)); @@ -728,7 +728,7 @@ void PROGRESS::draw(float x) { drawCylinder(false, pos, len, rad); } -PROGRESS_2D::PROGRESS_2D( +void PROGRESS_2D::init( GLfloat* p, GLfloat l, GLfloat w, GLfloat in, GLfloat* c, GLfloat* ic ) { memcpy(pos, p, sizeof(pos)); @@ -780,7 +780,7 @@ void PROGRESS_2D::draw(float x) { //----------------- RIBBON_GRAPH --------------------- -RIBBON_GRAPH::RIBBON_GRAPH(float* p, float* s, float* c, float* tc, float ty) { +void RIBBON_GRAPH::init(float* p, float* s, float* c, float* tc, float ty) { memcpy(pos, p, sizeof(pos)); memcpy(size, s, sizeof(size)); memcpy(color, c, sizeof(color)); @@ -792,10 +792,10 @@ void RIBBON_GRAPH::set_pos(float* p) { memcpy(pos, p, sizeof(pos)); } -float yvec[] = {0., 1., 0.}; -float xvec[] = {1., 0., 0.}; -float xvecneg[] = {-1., 0., 0.}; -float zvec[] = {0, 0, 1}; +static float yvec[] = {0., 1., 0.}; +static float xvec[] = {1., 0., 0.}; +static float xvecneg[] = {-1., 0., 0.}; +static float zvec[] = {0, 0, 1}; // draw XZ rect from i to i+1, with height data[i] // @@ -927,7 +927,11 @@ void crossProd(float a[3], float b[3], float out[3]) normalize(out); } -//makes a list of stars that lie on cocentric circles (inefficient, most will be out of sight) +STARFIELD::STARFIELD() { + stars = NULL; +} + +// // void STARFIELD::build_stars(int sz, float sp) { float modelview[16]; @@ -940,6 +944,7 @@ void STARFIELD::build_stars(int sz, float sp) { speed=sp; size=sz; + if (stars) free(stars); stars = (STAR*)calloc(sizeof(STAR), size); if(get_matrix_invert(modelview)==false) @@ -1053,6 +1058,13 @@ void STARFIELD::replace_star(int i) { // ------------ TEXTURE STUFF -------------------- // +struct tImageJPG { + int rowSpan; + int sizeX; + int sizeY; + unsigned char *data; +}; + struct Vertex { float tu, tv; diff --git a/api/gutil.h b/api/gutil.h index 32b36e485e..8bb0d0c066 100755 --- a/api/gutil.h +++ b/api/gutil.h @@ -104,7 +104,7 @@ class PROGRESS { float len, rad, inner_rad; public: float pos[3]; - PROGRESS(float* pos, float len, float diam, float inner, float* c, float* ic); + void init(float* pos, float len, float diam, float inner, float* c, float* ic); void draw(float); }; @@ -115,7 +115,7 @@ class PROGRESS_2D { float pos[3]; public: void set_pos(float*); - PROGRESS_2D(float* pos, float len, float width, float inner_width, float* c, float* ic); + void init(float* pos, float len, float width, float inner_width, float* c, float* ic); void draw(float); }; @@ -134,7 +134,7 @@ class RIBBON_GRAPH { float pos[3]; public: void set_pos(float*); - RIBBON_GRAPH(float* pos, float* size, float* color, float* tick_color, float tick_yfrac=0.2); + void init(float* pos, float* size, float* color, float* tick_color, float tick_yfrac=0.2); void draw(float* data, int len, bool with_ticks=false); void add_tick(float x, int index); }; @@ -164,7 +164,7 @@ public: }; -// ----- STUFF RELATED TO STARFIELDS +// ----- STARFIELDS // #define COS_30 0.8720254037f #define XY_HEIGHT 1656.85f @@ -183,21 +183,15 @@ class STARFIELD { void replace_star(int); bool is_visible(int,double[16],double[16],int[4]); STAR* stars; -public: +public: + STARFIELD(); void build_stars(int, float); void update_stars(float); }; -// ----- STUFF RELATED TO TEXTURES AND IMAGES - -#if 0 -#define IMAGE_TYPE_JPG 0 -#define IMAGE_TYPE_PPM 1 -#define IMAGE_TYPE_BMP 2 -#define IMAGE_TYPE_TGA 3 -#endif +// ----- TEXTURES AND IMAGES #define ALIGN_BOTTOM 0 #define ALIGN_CENTER 1 @@ -216,17 +210,8 @@ struct TEXTURE_DESC { int CreateTextureTGA(char* strFileName); }; -struct tImageJPG { - int rowSpan; - int sizeX; - int sizeY; - unsigned char *data; -}; -extern tImageJPG *LoadJPG(const char *filename); - - -// ----- STUFF RELATED TO FONTS +// ----- FONTS // extern unsigned int listBase; extern unsigned int MyCreateFont(char *fontName, int Size,int weight); diff --git a/api/reduce.C b/api/reduce.C index 17285fc460..90991fffa5 100644 --- a/api/reduce.C +++ b/api/reduce.C @@ -43,7 +43,7 @@ void REDUCED_ARRAY::set_max_dims(int mx, int my) { // Prepare to receive a source array. // (sx, sy) are dimensions of source array // -void REDUCED_ARRAY::init(int sx, int sy) { +void REDUCED_ARRAY::init_data(int sx, int sy) { sdimx = sx; sdimy = sy; if (sdimx > rdimx_max) { @@ -80,8 +80,10 @@ void REDUCED_ARRAY::reset() { last_ry_count = 0; } -void REDUCED_ARRAY::init_draw(GRAPH_STYLE st, float* p, float* s, double h0, double dh, float trans, - char* xl,char* yl,char* zl) { +void REDUCED_ARRAY::init_display( + GRAPH_STYLE st, float* p, float* s, double h0, double dh, float trans, + char* xl, char* yl, char* zl +) { memcpy(draw_pos, p, sizeof(draw_pos)); memcpy(draw_size, s, sizeof(draw_size)); draw_deltax = draw_size[0]/rdimx; @@ -399,7 +401,7 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) { */ // } glEnd(); - break; + break; case GRAPH_STYLE_SURFACE: glBegin(GL_TRIANGLE_STRIP); @@ -434,7 +436,7 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) { } } glEnd(); - break; + break; case GRAPH_STYLE_WIREFRAME: glLineWidth(1.0f); z0 = draw_pos[2] + (draw_size[2]*row)/rdimy; @@ -473,7 +475,7 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) { } glEnd(); glDisable(GL_LINE_SMOOTH); - break; + break; case GRAPH_STYLE_PLANES: z0 = draw_pos[2] + (draw_size[2]*row)/rdimy; z1 = z0+.14f; @@ -650,7 +652,8 @@ void REDUCED_ARRAY::draw_axis_labels() { void REDUCED_ARRAY::draw_axes() { - //float adj2=-.18f; + // comment?? + float adj2=0.0f;//-(draw_size[2]*1)/rdimy; float adj=0.0f; @@ -753,9 +756,8 @@ void REDUCED_ARRAY::draw_labels() { float wd=.015f; float l=1.0f; -// char* zlabel = "Time(sec)"; -// char* xlabel = "Frequency(HZ)"; -// char* plabel = "Power"; + + // what the hell are the following doing here?? char* zmax = "107.4"; char* zmin = "0"; @@ -796,14 +798,11 @@ void REDUCED_ARRAY::draw_labels() { //unscale modelview matrix double aspect_ratio = 4.0/3.0; - if ((double)h*aspect_ratio > (double)w) - { + if ((double)h*aspect_ratio > (double)w) { model[1]*=1.0f/(((double)w/aspect_ratio)/(double)h); model[5]*=1.0f/(((double)w/aspect_ratio)/(double)h); model[9]*=1.0f/(((double)w/aspect_ratio)/(double)h); - } - else - { + } else { model[0]*=1.0f/(((double)h*aspect_ratio)/(double)w); model[4]*=1.0f/(((double)h*aspect_ratio)/(double)w); model[8]*=1.0f/(((double)h*aspect_ratio)/(double)w); diff --git a/api/reduce.h b/api/reduce.h index 606bac4fe6..74eafbf1e5 100644 --- a/api/reduce.h +++ b/api/reduce.h @@ -64,8 +64,10 @@ public: REDUCED_ARRAY(); ~REDUCED_ARRAY(); - void init(int, int); - void init_draw(GRAPH_STYLE, float*, float*, double, double, float,char*,char*,char*); + void init_data(int, int); + void init_display( + GRAPH_STYLE, float*, float*, double, double, float, char*, char*, char* + ); void set_max_dims(int, int); void reduce_source_row(float*, float*); void add_source_row(float*); diff --git a/api/windows_opengl.C b/api/windows_opengl.C index 45ae494970..382899cfd5 100755 --- a/api/windows_opengl.C +++ b/api/windows_opengl.C @@ -163,13 +163,13 @@ void SetMode(int mode) { // do GL initialization every time, since we're creating a new window // InitGL(); - app_init_gl(); + app_graphics_init(); // tell the core client that we're entering new mode // if (app_client_shm) { - app_client_shm->send_graphics_mode_msg( - APP_CORE_GFX_SEG, current_graphics_mode + app_client_shm->send_graphics_msg( + APP_CORE_GFX_SEG, GRAPHICS_MSG_SET_MODE, current_graphics_mode ); } } @@ -182,7 +182,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window LPARAM lParam) // Additional Message Information { RECT rt; - int width, height, new_mode; + int width, height, new_mode, msg; static bool visible = true; switch(uMsg) { @@ -235,8 +235,17 @@ LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window ReSizeGLScene(LOWORD(lParam),HIWORD(lParam)); return 0; case WM_TIMER: - if (app_client_shm && app_client_shm->get_graphics_mode_msg(CORE_APP_GFX_SEG, new_mode)) { - SetMode(new_mode); + if (app_client_shm) { + if (app_client_shm->get_graphics_msg(CORE_APP_GFX_SEG, msg, new_mode)) { + switch (msg) { + case GRAPHICS_MSG_SET_MODE: + SetMode(new_mode); + break; + case GRAPHICS_MSG_REREAD_PREFS: + app_graphics_reread_prefs(); + break; + } + } } if (!visible) return 0; if (current_graphics_mode == MODE_HIDE_GRAPHICS) return 0; diff --git a/checkin_notes b/checkin_notes index 7255638d57..efcf7648ea 100755 --- a/checkin_notes +++ b/checkin_notes @@ -6537,34 +6537,34 @@ Karl 2003/10/02 configxml.py David Oct 4 2003 - - throttled_app_render() returns true iff it rendered anything. - This lets the caller do swapbuffers only if needed - - app_render() now returns void - - added functions that read graphics files (JPEG, PPM, BMP, TGA) - and create textures (moved from SETI@home) + - throttled_app_render() returns true iff it rendered anything. + This lets the caller do swapbuffers only if needed + - app_render() now returns void + - added functions that read graphics files (JPEG, PPM, BMP, TGA) + and create textures (moved from SETI@home) - api/ - graphics_api.C,h - gutil.C,h - windows_opengl.C - lib/ - xml_util.C + api/ + graphics_api.C,h + gutil.C,h + windows_opengl.C + lib/ + xml_util.C David Oct 6 2003 - - Created class MOVING_TEXT_PANEL (in boinc/api/gutil.h) - to do Astropulse-type text display - - Created class TEXTURE_DESC (same place) - to represent an OpenGL texture (including its ID and size). - - Modify draw_texture() to not change the aspect ratio of the picture; - it shrinks the image in one dimension or the other, and centers - it in the allotted space - - Add a GRAPH_DRAW_STYLE field to REDUCED_ARRAY - - Eliminate methods of REDUCED_ARRAY that take a style argument + - Created class MOVING_TEXT_PANEL (in boinc/api/gutil.h) + to do Astropulse-type text display + - Created class TEXTURE_DESC (same place) + to represent an OpenGL texture (including its ID and size). + - Modify draw_texture() to not change the aspect ratio of the picture; + it shrinks the image in one dimension or the other, and centers + it in the allotted space + - Add a GRAPH_DRAW_STYLE field to REDUCED_ARRAY + - Eliminate methods of REDUCED_ARRAY that take a style argument - api/ - graphics_api.C - gutil.C,h - reduce.C,h + api/ + graphics_api.C + gutil.C,h + reduce.C,h Karl 2003/10/06 - client release 2.04 @@ -6627,13 +6627,13 @@ Oliver Oct 8 2003 windows_opengl.c David Oct 8 2003 - - made draw, CreateTextureJPG etc. into member functions of TEXTURE_DESC - - added xalign, yalign args to TEXTURE_DESC::draw() - - attempted to turn off rendering when window is hidden (don't think I succeeded) + - made draw, CreateTextureJPG etc. into member functions of TEXTURE_DESC + - added xalign, yalign args to TEXTURE_DESC::draw() + - attempted to turn off rendering when window is hidden (don't think I succeeded) - api/ - gutil.C,h - windows_opengl.C + api/ + gutil.C,h + windows_opengl.C Oliver Oct 9 2003 - fixed error handling when jpeglib fails @@ -6662,11 +6662,11 @@ Karl 2003/10/08 transitioner.C David Oct 10 2003 - - made STARFIELD CLASS - - implement tickmarks for RIBBON_GRAPH + - made STARFIELD CLASS + - implement tickmarks for RIBBON_GRAPH - api/ - gutil.C,h + api/ + gutil.C,h David Oct 10 2003 - various web stuff @@ -6747,20 +6747,20 @@ Oliver Oct 13 2003 David Oct 14 2003 - - don't call boinc_finish_opengl() in boinc_finish()!! - - max frame rate and max graphics CPU are accessible to app - (via global variables boinc_max_fps and boinc_max_gfx_cpu_frac) - - in windows_opengl.C, moved InitGL() and app_init_gl() calls - from SetMode() to start of win_graphics_event_loop() - (just want to call these once, right?) - - in windows_opengl.C: if in standalone mode and get WM_CLOSE event, - actually exit (makes debugging easier). + - don't call boinc_finish_opengl() in boinc_finish()!! + - max frame rate and max graphics CPU are accessible to app + (via global variables boinc_max_fps and boinc_max_gfx_cpu_frac) + - in windows_opengl.C, moved InitGL() and app_init_gl() calls + from SetMode() to start of win_graphics_event_loop() + (just want to call these once, right?) + - in windows_opengl.C: if in standalone mode and get WM_CLOSE event, + actually exit (makes debugging easier). - api/ - boinc_api.C - graphics_api.C,h - gutil.C - windows_opengl.C + api/ + boinc_api.C + graphics_api.C,h + gutil.C + windows_opengl.C Oliver Oct 14 2003 - stars now draw in visible pyramid with original coordinate system @@ -6774,11 +6774,11 @@ Oliver Oct 14 2003 David Oct 14 2003 - extended MOVING_TEXT_PANEL interface to let you draw text on - particular line numbers, - and get the coords the start of a line number + particular line numbers, + and get the coords the start of a line number - api/ - gutil.C,h + api/ + gutil.C,h Karl 2003-10-14 - makefiles: @@ -6848,14 +6848,14 @@ David 16 Oct 2003 since it's included (and needed) in UNIX as well as Windows Oliver 16 Oct 2003 - - Implemented scaling factor to center objects - - Fixed starfields - - Right justified text + - Implemented scaling factor to center objects + - Fixed starfields + - Right justified text - api/ - graphics_api.C - gutil.C,h - windows_opengl.C + api/ + graphics_api.C + gutil.C,h + windows_opengl.C Karl 2003-10-16 - updated python database API with new workunit.userid field @@ -6939,9 +6939,9 @@ Karl 2003-10-19 wingui_mainwindow.cpp David 20 Oct 2003 - - fixed bug that prevented screensaver from launching core client + - fixed bug that prevented screensaver from launching core client - win_screensaver.cpp + win_screensaver.cpp Karl 2003-10-20 - BOINC client release 2.05 @@ -6972,12 +6972,12 @@ David 20 Oct 2003 David 20 Oct 2003 - - changed CPU benchmark code to store all times as doubles. - This might fix the "negative fpops/sec" bug + - changed CPU benchmark code to store all times as doubles. + This might fix the "negative fpops/sec" bug - client/ - cpu_benchmark.C - cs_benchmark.C + client/ + cpu_benchmark.C + cs_benchmark.C David 20 Oct 2003 - changed overflowing integer calculation in CPU checkpoint code. @@ -6999,34 +6999,34 @@ David 22 Oct 2003 cs_files.C David 22 Oct 2003 - - fixed bug that caused project disk usage to be reported as zero - - Added debugging printfs (enabled by #define DEBUG) + - fixed bug that caused project disk usage to be reported as zero + - Added debugging printfs (enabled by #define DEBUG) to wingui_mainwindow.cpp. These write to C:/temp/core.txt. - - In CMyApp::InitInstance(), changed 2nd arg of CreateMutex + - In CMyApp::InitInstance(), changed 2nd arg of CreateMutex from false to true. This matches "1 instance" code samples from web. - Thought it might fix startup bug - no. - - Added debugging printfs (enabled by #define DEBUG) into screensaver; - causes it to write info to C:/temp/boinc_scr.txt - - Removed CREATE_NO_WINDOW and IDLE_PRIORITY flags from - CreateProcess() call in screensaver. - These aren't listed in the MSDN man page; are they needed? - - slight change to startup logic in screensaver: - - send it a BOINC_SS_START message only if it's already running - (not needed if start it ourselves, since we give it -saver arg) - - don't wait for 3 seconds after starting it - - In the cmdline passed to the core client from screensaver, - make argv[0] the real path of the executable. - Thought this might fix startup bug - no. - - Change "start_saver" to "started_by_screensaver". Truth in advertising. + Thought it might fix startup bug - no. + - Added debugging printfs (enabled by #define DEBUG) into screensaver; + causes it to write info to C:/temp/boinc_scr.txt + - Removed CREATE_NO_WINDOW and IDLE_PRIORITY flags from + CreateProcess() call in screensaver. + These aren't listed in the MSDN man page; are they needed? + - slight change to startup logic in screensaver: + - send it a BOINC_SS_START message only if it's already running + (not needed if start it ourselves, since we give it -saver arg) + - don't wait for 3 seconds after starting it + - In the cmdline passed to the core client from screensaver, + make argv[0] the real path of the executable. + Thought this might fix startup bug - no. + - Change "start_saver" to "started_by_screensaver". Truth in advertising. - client/ - client_state.C,h - cs_cmdline.C - win/ - win_screensaver.cpp - wingui_mainwindow.cpp - lib/ - filesys.C + client/ + client_state.C,h + cs_cmdline.C + win/ + win_screensaver.cpp + wingui_mainwindow.cpp + lib/ + filesys.C David 24 Oct 2003 - complete Bob's addition of SETI@home "grandfather" fields to DB @@ -7043,7 +7043,7 @@ Oliver 24 Oct 2003 is created api/ - reduce.h,C + reduce.h,C David 24 Oct 2003 - db_dump generates valid XML @@ -7068,21 +7068,21 @@ Karl 2003-10-25 David 25 Oct 2003 - - removed code that caps backoff count at one - TODO: we still need to reexamine the backoff policy, - so that multiple file failures don't lead to huge backoffs - - moved OpenGL init calls from the start of the event loop - back to SetMode, undoing an earlier change. - Turns out the need to be in SetMode because it creates a new - window every time. - This should fix the bug that cause Astropulse to show no graphics. - TODO: make sure that when an application window is hidden, - no rendering work gets done. + - removed code that caps backoff count at one + TODO: we still need to reexamine the backoff policy, + so that multiple file failures don't lead to huge backoffs + - moved OpenGL init calls from the start of the event loop + back to SetMode, undoing an earlier change. + Turns out the need to be in SetMode because it creates a new + window every time. + This should fix the bug that cause Astropulse to show no graphics. + TODO: make sure that when an application window is hidden, + no rendering work gets done. - api/ - windows_opengl.C - client/ - scheduler_op.C + api/ + windows_opengl.C + client/ + scheduler_op.C Karl 2003-10-25 - updated_versions: don't be so verbose unless "-v" verbose command-line @@ -7098,36 +7098,36 @@ Karl 2003-10-25 tools.py David 27 Oct 2003 - - Parse project-specific prefs correctly (i.e. based on venue) - These prefs are read from account files. - Account files are read before the client state file is parsed. - This presented a problem because the host venue, - which is needed to decide which project prefs to use, - is kept in the client state file. - So I added a new function, parse_venue(), that gets the - host venue from the state file; this is done before parsing account files. - - Also added element to account file so that we can - display that correctly in message about project prefs + - Parse project-specific prefs correctly (i.e. based on venue) + These prefs are read from account files. + Account files are read before the client state file is parsed. + This presented a problem because the host venue, + which is needed to decide which project prefs to use, + is kept in the client state file. + So I added a new function, parse_venue(), that gets the + host venue from the state file; this is done before parsing account files. + - Also added element to account file so that we can + display that correctly in message about project prefs - api/ - windows_opengl.C - client/ - client_state.C,h - client_types.C - cs_statefile.C - pers_file_xfer.h - prefs.C + api/ + windows_opengl.C + client/ + client_state.C,h + client_types.C + cs_statefile.C + pers_file_xfer.h + prefs.C Oliver 27 Oct 2003 - - Fixed efficiency bugs in starfield - api/ - gutil.C,h + - Fixed efficiency bugs in starfield + api/ + gutil.C,h Eric K 27 Oct 2003 - - xml_indent() is now limited to a max of 40 spaces. + - xml_indent() is now limited to a max of 40 spaces. lib/ - xml_util.h + xml_util.h David 27 Oct 2003 - let users see list of all their results @@ -7197,16 +7197,16 @@ Oliver 29 Oct 2003 - fixed improperly scaled logos api/ - gutil.C,h - + gutil.C,h + David 28 Oct 2003 - - app library: don't access shared memory if it's not there - (should keep non-standalone version from crashing - when run in isolation) + - app library: don't access shared memory if it's not there + (should keep non-standalone version from crashing + when run in isolation) - api/ - windows_opengl.C + api/ + windows_opengl.C Karl 2003-10-29 - removed test_sanity check from configure @@ -7218,18 +7218,18 @@ Karl 2003-10-29 make_project David 30 Oct 2003 - - On call to CreateEvent() to make "event" object for - core client to ask app to quit (Windows) - changed ManualReset argument to false. - This fixes a bug where, after resetting a project, - all apps get quit signal immediately - - Change CLIENT_STATE::report_result_error() so that it - takes a format string and varargs + - On call to CreateEvent() to make "event" object for + core client to ask app to quit (Windows) + changed ManualReset argument to false. + This fixes a bug where, after resetting a project, + all apps get quit signal immediately + - Change CLIENT_STATE::report_result_error() so that it + takes a format string and varargs - client/ - app.C - client_state.C,h - pers_file_xfer.C + client/ + app.C + client_state.C,h + pers_file_xfer.C David 30 Oct 2003 - API writes to stderr if get quit request @@ -7267,3 +7267,51 @@ David 31 Oct 2003 prefs.php prefs_edit_action.php stats.php (new) + +David 31 Oct 2003 + - Added a mechanism allowing applications to change their graphics + "on the fly" in response to new project preferences: + - Added a new message type to the + core->app graphics segment + - When the graphics framework (windows_opengl.C) gets this message, + it calls an application function app_graphics_reread_prefs(). + This function can call boinc_parse_init_data_file() (see below) + to get the new prefs + - Core client: when get new project preferences, + write new init_data.xml files for all running apps, + and send them messages. + New functions: + ACTIVE_TASK::write_app_init_file() + ACTIVE_TASK::request_reread_prefs() + ACTIVE_TASK_SET::request_reread_prefs(PROJECT*) + - name changes: + old new + boinc_init_opengl boinc_init_graphics + boinc_finish_opengl boinc_finish_graphics + app_init_gl app_graphics_init + app_render app_graphics_render + app_resize app_graphics_resize + REDUCED_ARRAY::init init_data + REDUCED_ARRAY::init_draw init_display:$ + - changed graphics objects (PROGRESS, PROGRESS2D, RIBBON_GRAPH) + to use init() functions instead of constructor for setup; + changed STARFIELD::build_stars() so that it can be called repeatedly + - factored code to read init_data.xml into a new function + boinc_parse_init_data_file() + - moved tImageJPG out of the .h file - it's not interface + + api/ + boinc_api.C,h + graphics_api.C,h + gutil.C,h + reduce.C,h + windows_opengl.C + client/ + app.C,h + cs_scheduler.C + doc/ + graphics.sxd (new) + graphics.png (new) + lib/ + app_ipc.C + parse.C,h diff --git a/client/app.C b/client/app.C index 704a139607..2a1fe0d142 100644 --- a/client/app.C +++ b/client/app.C @@ -130,36 +130,10 @@ int ACTIVE_TASK::init(RESULT* rp) { return 0; } -// Start a task in a slot directory. -// This includes setting up soft links, -// passing preferences, and starting the process -// -// Current dir is top-level BOINC dir -// -int ACTIVE_TASK::start(bool first_time) { - char exec_name[256], file_path[256], link_path[256], buf[256], exec_path[256]; - unsigned int i; - FILE_REF file_ref; - FILE_INFO* fip; - int retval; - char init_data_path[256], graphics_data_path[256], fd_init_path[256]; +int ACTIVE_TASK::write_app_init_file(APP_INIT_DATA& aid) { FILE *f; - APP_INIT_DATA aid; - GRAPHICS_INFO gi; - - ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_TASK); - scope_messages.printf("ACTIVE_TASK::start(first_time=%d)\n", first_time); - - if (first_time) { - checkpoint_cpu_time = 0; - } - current_cpu_time = checkpoint_cpu_time; - starting_cpu_time = checkpoint_cpu_time; - fraction_done = 0; - - gi.xsize = 800; - gi.ysize = 600; - gi.refresh_period = 0.1; + char init_data_path[256]; + int retval; memset(&aid, 0, sizeof(aid)); @@ -167,11 +141,14 @@ int ACTIVE_TASK::start(bool first_time) { safe_strcpy(aid.user_name, wup->project->user_name); safe_strcpy(aid.team_name, wup->project->team_name); if (wup->project->project_specific_prefs) { +#if 0 extract_venue( wup->project->project_specific_prefs, gstate.host_venue, aid.app_preferences ); +#endif + strcpy(aid.app_preferences, wup->project->project_specific_prefs); } aid.user_total_credit = wup->project->user_total_credit; aid.user_expavg_credit = wup->project->user_expavg_credit; @@ -203,9 +180,43 @@ int ACTIVE_TASK::start(bool first_time) { #endif retval = write_init_data_file(f, aid); - if (retval) return retval; - fclose(f); + return retval; +} + +// Start a task in a slot directory. +// This includes setting up soft links, +// passing preferences, and starting the process +// +// Current dir is top-level BOINC dir +// +int ACTIVE_TASK::start(bool first_time) { + char exec_name[256], file_path[256], link_path[256], buf[256], exec_path[256]; + unsigned int i; + FILE_REF file_ref; + FILE_INFO* fip; + int retval; + char graphics_data_path[256], fd_init_path[256]; + FILE *f; + GRAPHICS_INFO gi; + APP_INIT_DATA aid; + + ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_TASK); + scope_messages.printf("ACTIVE_TASK::start(first_time=%d)\n", first_time); + + if (first_time) { + checkpoint_cpu_time = 0; + } + current_cpu_time = checkpoint_cpu_time; + starting_cpu_time = checkpoint_cpu_time; + fraction_done = 0; + + gi.xsize = 800; + gi.ysize = 600; + gi.refresh_period = 0.1; + + retval = write_app_init_file(aid); + if (retval) return retval; sprintf(graphics_data_path, "%s%s%s", slot_dir, PATH_SEPARATOR, GRAPHICS_DATA_FILE); f = fopen(graphics_data_path, "w"); @@ -798,10 +809,27 @@ bool ACTIVE_TASK::read_stderr_file() { return false; } -void ACTIVE_TASK::request_reread_prefs() { +int ACTIVE_TASK::request_reread_prefs() { + int retval; + APP_INIT_DATA aid; + + retval = write_app_init_file(aid); + if (retval) return retval; app_client_shm.send_graphics_msg( CORE_APP_GFX_SEG, GRAPHICS_MSG_REREAD_PREFS, 0 ); + return 0; +} + +void ACTIVE_TASK_SET::request_reread_prefs(PROJECT* project) { + unsigned int i; + ACTIVE_TASK* atp; + + for (i=0; iresult->project != project) continue; + atp->request_reread_prefs(); + } } void ACTIVE_TASK::request_graphics_mode(int mode) { diff --git a/client/app.h b/client/app.h index d79d21b4e2..603ef1c93e 100644 --- a/client/app.h +++ b/client/app.h @@ -99,6 +99,7 @@ public: int graphics_acked_mode; // most recent mode reported by app int graphics_mode_before_ss; // mode before last screensaver request void request_graphics_mode(int); + int request_reread_prefs(); void check_graphics_mode_ack(); ACTIVE_TASK(); @@ -121,6 +122,7 @@ public: double est_time_to_completion(); bool read_stderr_file(); bool supports_graphics(); + int write_app_init_file(APP_INIT_DATA&); int write(FILE*); int parse(FILE*, CLIENT_STATE*); @@ -155,6 +157,7 @@ public: void hide_apps(); void restore_apps(); void check_graphics_mode_ack(); + void request_reread_prefs(PROJECT*); int write(FILE*); int parse(FILE*, CLIENT_STATE*); diff --git a/client/cs_scheduler.C b/client/cs_scheduler.C index 541ae537ad..09b49fb998 100644 --- a/client/cs_scheduler.C +++ b/client/cs_scheduler.C @@ -468,6 +468,7 @@ int CLIENT_STATE::handle_scheduler_reply( strcpy(project->project_specific_prefs, sr.project_prefs_xml); retval = project->write_account_file(); if (retval) return retval; + active_tasks.request_reread_prefs(project); } } diff --git a/doc/graphics.png b/doc/graphics.png new file mode 100644 index 0000000000..089dea30be Binary files /dev/null and b/doc/graphics.png differ diff --git a/doc/graphics.sxd b/doc/graphics.sxd new file mode 100644 index 0000000000..9ee9915c7f Binary files /dev/null and b/doc/graphics.sxd differ diff --git a/lib/app_ipc.C b/lib/app_ipc.C index 5b60d3dd46..c567370625 100755 --- a/lib/app_ipc.C +++ b/lib/app_ipc.C @@ -33,6 +33,8 @@ char* xml_graphics_modes[5] = { "" }; +#define REREAD_PREFS_MSG "" + int write_init_data_file(FILE* f, APP_INIT_DATA& ai) { if (strlen(ai.app_name)) { fprintf(f, "%s\n", ai.app_name); diff --git a/lib/parse.C b/lib/parse.C index 2ad5e6bc33..e3308dce57 100644 --- a/lib/parse.C +++ b/lib/parse.C @@ -203,6 +203,7 @@ void replace_element(char* buf, char* start, char* end, char* replacement) { strcat(p, temp); } +#if 0 // if the given XML has an element of the form // // ... @@ -231,6 +232,7 @@ void extract_venue(const char* in, const char* venue_name, char* out) { } } } +#endif // copy a line from the given string. // kinda like fgets() when you're reading from a string diff --git a/lib/parse.h b/lib/parse.h index 847670627b..7a7450b4d6 100644 --- a/lib/parse.h +++ b/lib/parse.h @@ -37,7 +37,7 @@ extern int dup_element_contents(FILE* in, const char* end_tag, char** pp); extern int copy_element_contents(FILE* in, const char* end_tag, char* p, int len); extern int read_file_malloc(const char* pathname, char*& str); extern void replace_element(char* buf, char* start, char* end, char* replacement); -extern void extract_venue(const char* in, const char* venue_name, char* out); +//extern void extract_venue(const char* in, const char* venue_name, char* out); extern char* sgets(char* buf, int len, char* &in); extern bool extract_xml_record(const std::string &field, const char *tag, std::string &record);