* Enlightenment SVN <no-re...@enlightenment.org> [2010-11-29 02:52:33 -0800]:

> Log:
>   happy lucky fun improvement in cpufreq gadget - dial moves smoothly
>   now... and uses map... like clock... and i added 2 more mini dialos
>   for min and max freq if u have multiple cores at differetn frequencies
>   :) red one now has a white tip for easier visbility and shows average
>   of all cores.

I loved it :)

>   
>   
> Author:       raster
> Date:         2010-11-29 02:52:32 -0800 (Mon, 29 Nov 2010)
> New Revision: 55054
> 
> Added:
>   trunk/e/data/themes/images/t0-sh.png trunk/e/data/themes/images/t0.png 
> trunk/e/data/themes/images/t1-sh.png trunk/e/data/themes/images/t1.png 
> trunk/e/data/themes/images/t2.png 
> Removed:
>   trunk/e/data/themes/images/tacho_dial_00.png 
> trunk/e/data/themes/images/tacho_dial_01.png 
> trunk/e/data/themes/images/tacho_dial_02.png 
> trunk/e/data/themes/images/tacho_dial_03.png 
> trunk/e/data/themes/images/tacho_dial_04.png 
> trunk/e/data/themes/images/tacho_dial_05.png 
> trunk/e/data/themes/images/tacho_dial_06.png 
> trunk/e/data/themes/images/tacho_dial_07.png 
> trunk/e/data/themes/images/tacho_dial_08.png 
> trunk/e/data/themes/images/tacho_dial_09.png 
> trunk/e/data/themes/images/tacho_dial_10.png 
> trunk/e/data/themes/images/tacho_dial_11.png 
> trunk/e/data/themes/images/tacho_dial_12.png 
> trunk/e/data/themes/images/tacho_dial_13.png 
> trunk/e/data/themes/images/tacho_dial_14.png 
> trunk/e/data/themes/images/tacho_dial_15.png 
> Modified:
>   trunk/e/data/themes/default.edc trunk/e/data/themes/images/Makefile.am 
> trunk/e/src/modules/cpufreq/e_mod_main.c 
> trunk/e/src/modules/cpufreq/e_mod_main.h 
> 
> Modified: trunk/e/data/themes/default.edc
> ===================================================================
> --- trunk/e/data/themes/default.edc   2010-11-29 07:07:16 UTC (rev 55053)
> +++ trunk/e/data/themes/default.edc   2010-11-29 10:52:32 UTC (rev 55054)
> @@ -12183,6 +12183,7 @@
>  /////////////////////////////////////////////////////////////////////////////
>  /*** MOD: CPUFREQ ***/
>  
> +#if 0
>     group {
>        name: "e/modules/cpufreq/main";
>        images {
> @@ -12514,8 +12515,343 @@
>           }
>        }
>     }
> +#else
> +   group {
> +      name: "e/modules/cpufreq/main";
> +      images {
> +         image: "tacho_bg.png" COMP;
> +         image: "tacho_fg.png" COMP;
> +         image: "t0.png" COMP;
> +         image: "t0-sh.png" COMP;
> +         image: "t1.png" COMP;
> +         image: "t1-sh.png" COMP;
> +         image: "t2.png" COMP;
> +      }
> +      min: 16 16;
> +      max: 128 128;
> +      script {
> +         public available_frequencies;
> +         public available_governors;
>  
> +         public cur_freq_old;
> +         public cur_freq_new;
> +         public cur_freq_now;
> +         public cur_freq_anim;
>  
> +         public min_freq_old;
> +         public min_freq_new;
> +         public min_freq_now;
> +
> +         public max_freq_old;
> +         public max_freq_new;
> +         public max_freq_now;
> +        
> +         public slide_cur_freq(val, Float:v) {
> +            new Float:freq, Float:min_freq, Float:max_freq, Float:tf;
> +            new f, f0, f1;
> +           
> +            v = (1.0 - cos(v * 3.141592654)) / 2.0;
> +           
> +            min_freq = fetch_int(available_frequencies, 0);
> +            max_freq = fetch_int(available_frequencies,
> +                                 count(available_frequencies) - 1);
> +           
> +            f0 = get_int(cur_freq_old);
> +            f1 = get_int(cur_freq_new);
> +            f = f1 - f0;
> +            freq = float(f) * v;
> +            f = round(freq);
> +            f = f + f0;
> +            set_int(cur_freq_now, f);
> +           
> +            freq = (float(f) - min_freq) / (max_freq - min_freq);
> +            tf = (freq * 225.0) - 135.0;
> +            custom_state(PART:"meter", "default", 0.0);
> +            set_state_val(PART:"meter", STATE_MAP_ROT_Z, tf);
> +            set_state(PART:"meter", "custom", 0.0);
> +            custom_state(PART:"meter_sh", "default", 0.0);
> +            set_state_val(PART:"meter_sh", STATE_MAP_ROT_Z, tf);
> +            set_state(PART:"meter_sh", "custom", 0.0);
> +           
> +            f0 = get_int(min_freq_old);
> +            f1 = get_int(min_freq_new);
> +            f = f1 - f0;
> +            freq = float(f) * v;
> +            f = round(freq);
> +            f = f + f0;
> +            set_int(min_freq_now, f);
> +           
> +            freq = (float(f) - min_freq) / (max_freq - min_freq);
> +            tf = (freq * 225.0) - 135.0;
> +            custom_state(PART:"meter_min", "default", 0.0);
> +            set_state_val(PART:"meter_min", STATE_MAP_ROT_Z, tf);
> +            set_state(PART:"meter_min", "custom", 0.0);
> +            custom_state(PART:"meter_min_sh", "default", 0.0);
> +            set_state_val(PART:"meter_min_sh", STATE_MAP_ROT_Z, tf);
> +            set_state(PART:"meter_min_sh", "custom", 0.0);
> +           
> +            f0 = get_int(max_freq_old);
> +            f1 = get_int(max_freq_new);
> +            f = f1 - f0;
> +            freq = float(f) * v;
> +            f = round(freq);
> +            f = f + f0;
> +            set_int(max_freq_now, f);
> +           
> +            freq = (float(f) - min_freq) / (max_freq - min_freq);
> +            tf = (freq * 225.0) - 135.0;
> +            custom_state(PART:"meter_max", "default", 0.0);
> +            set_state_val(PART:"meter_max", STATE_MAP_ROT_Z, tf);
> +            set_state(PART:"meter_max", "custom", 0.0);
> +            custom_state(PART:"meter_max_sh", "default", 0.0);
> +            set_state_val(PART:"meter_max_sh", STATE_MAP_ROT_Z, tf);
> +            set_state(PART:"meter_max_sh", "custom", 0.0);
> +           
> +            if (v >= 1.0) {
> +              set_int(cur_freq_anim, 0);
> +              return 0;
> +            }
> +            return 1;
> +         }
> +        
> +         public message(Msg_Type:type, id, ...) {
> +            if ((type == MSG_INT_SET) && (id == 1)) { // add an available 
> freq
> +               while (count(available_frequencies) > 0) {
> +                  remove(available_frequencies, 0);
> +               }
> +               for (new i = 2; i < numargs(); i++) {
> +                  append_int(available_frequencies, getarg(i));
> +               }
> +            } 
> +            else if ((type == MSG_STRING_SET) && (id == 2)) { // add a 
> governor
> +               new text[100];
> +               while (count(available_governors) > 0) {
> +                  remove(available_governors, 0);
> +               }
> +               for (new i = 2; i < numargs(); i++) {
> +                  snprintf(text, 100, "%s", getarg(i));
> +                  append_str(available_governors, text);
> +               }
> +            } 
> +            else if ((type == MSG_INT_SET) && (id == 3)) { // avg freq
> +               new f;
> +               new ani, curf, minf, maxf;
> +               new text[100];
> +
> +               f = getarg(2);              
> +               if (f < 1000000) snprintf(text, 100, "%i", f / 1000);
> +               else snprintf(text, 100, "%i.%i", f / 1000000,
> +                             (f % 1000000) / 100000);
> +               set_text(PART:"readout", text);
> +              
> +               ani = get_int(cur_freq_anim);
> +               if (ani > 0) cancel_anim(ani);
> +               ani = anim(1.0, "slide_cur_freq", 0);
> +               set_int(cur_freq_anim, ani);
> +              
> +               f = getarg(2);
> +               curf = get_int(cur_freq_now);
> +               set_int(cur_freq_old, curf);
> +               set_int(cur_freq_new, f);
> +              
> +               f = getarg(4);
> +               minf = get_int(min_freq_now);
> +               set_int(min_freq_old, minf);
> +               set_int(min_freq_new, f);
> +              
> +               f = getarg(5);
> +               maxf = get_int(max_freq_now);
> +               set_int(max_freq_old, maxf);
> +               set_int(max_freq_new, f);
> +            } 
> +            else if ((type == MSG_STRING) && (id == 4)) {
> +               new text[100];
> +               snprintf(text, 100, "%s", getarg(2));
> +            }
> +         }
> +      }
> +      parts {
> +         part {
> +            name: "fade_clip";
> +            type: RECT;
> +            mouse_events: 0;
> +            description {
> +               state: "default" 0.0;
> +               color: 255 255 255 255;
> +            }
> +            description {
> +               state: "faded" 0.0;
> +               color: 255 255 255 128;
> +            }
> +         }
> +         part {
> +            name: "base";
> +            clip_to: "fade_clip";
> +            description {
> +               state: "default" 0.0;
> +               aspect: 1.0 1.0;
> +               aspect_preference: BOTH;
> +               image.normal: "tacho_bg.png";
> +            }
> +         }
> +         part {
> +            name: "readout";
> +            type: TEXT;
> +            scale: 1;
> +            // effect: OUTLINE_SOFT_SHADOW;
> +            mouse_events: 0;
> +            clip_to: "fade_clip";
> +            description {
> +               state: "default" 0.0;
> +               rel1 {
> +                  relative: 0.6 0.7;
> +                  offset: 0 0;
> +               }
> +               rel2 {
> +                  relative: 0.6 0.7;
> +                  offset: 0 0;
> +               }
> +               color: 255 255 255 255;
> +               color2: 0 0 0 128;
> +               color3: 0 0 0 32;
> +               color_class: "module_label";
> +               text {
> +                  text: "??? Ghz";
> +                  font: "Sans:style=Bold";
> +                  size: 6;
> +                  align: 0.5 0.5;
> +                  min: 1 1;
> +                  text_class: "module_small";
> +               }
> +            }
> +         }
> +         part { name: "meter_min_sh";
> +            clip_to: "fade_clip";
> +            mouse_events: 0;
> +            description { state: "default" 0.0000;
> +               image.normal: "t1-sh.png";
> +               rel1.to: "meter_min";
> +               rel1.relative: 0.0+(2.0/64.0) 0.0+(2.0/64.0);
> +               rel2.to: "meter_min";
> +               rel2.relative: 1.0+(2.0/64.0) 1.0+(2.0/64.0);
> +               map {
> +                  on: 1;
> +                  rotation {
> +                     center: "meter_min_sh";
> +                  }
> +               }
> +            }
> +         }
> +         part { name: "meter_min";
> +            clip_to: "fade_clip";
> +            mouse_events: 0;
> +            description { state: "default" 0.0000;
> +               image.normal: "t2.png";
> +               rel1.to: "base";
> +               rel2.to: "base";
> +               map {
> +                  on: 1;
> +                  rotation {
> +                     center: "base";
> +                  }
> +               }
> +            }
> +         }
> +         part { name: "meter_max_sh";
> +            clip_to: "fade_clip";
> +            mouse_events: 0;
> +            description { state: "default" 0.0000;
> +               image.normal: "t1-sh.png";
> +               rel1.to: "meter_max";
> +               rel1.relative: 0.0+(2.0/64.0) 0.0+(2.0/64.0);
> +               rel2.to: "meter_max";
> +               rel2.relative: 1.0+(2.0/64.0) 1.0+(2.0/64.0);
> +               map {
> +                  on: 1;
> +                  rotation {
> +                     center: "meter_max_sh";
> +                  }
> +               }
> +            }
> +         }
> +         part { name: "meter_max";
> +            clip_to: "fade_clip";
> +            mouse_events: 0;
> +            description { state: "default" 0.0000;
> +               image.normal: "t1.png";
> +               rel1.to: "base";
> +               rel2.to: "base";
> +               map {
> +                  on: 1;
> +                  rotation {
> +                     center: "base";
> +                  }
> +               }
> +            }
> +         }
> +         part { name: "meter_sh";
> +            clip_to: "fade_clip";
> +            mouse_events: 0;
> +            description { state: "default" 0.0000;
> +               image.normal: "t0-sh.png";
> +               rel1.to: "meter";
> +               rel1.relative: 0.0+(2.0/64.0) 0.0+(2.0/64.0);
> +               rel2.to: "meter";
> +               rel2.relative: 1.0+(2.0/64.0) 1.0+(2.0/64.0);
> +               map {
> +                  on: 1;
> +                  rotation {
> +                     center: "meter_sh";
> +                  }
> +               }
> +            }
> +         }
> +         part { name: "meter";
> +            clip_to: "fade_clip";
> +            mouse_events: 0;
> +            description { state: "default" 0.0000;
> +               image.normal: "t0.png";
> +               rel1.to: "base";
> +               rel2.to: "base";
> +               map {
> +                  on: 1;
> +                  rotation {
> +                     center: "base";
> +                  }
> +               }
> +            }
> +         }
> +         part {
> +            name: "over";
> +            clip_to: "fade_clip";
> +            mouse_events: 0;
> +            description {
> +               state: "default" 0.0;
> +               rel1.to: "base";
> +               rel2.to: "base";
> +               image.normal: "tacho_fg.png";
> +            }
> +         }
> +      }
> +      programs {
> +         program {
> +            name: "enabled";
> +            signal: "e,state,enabled";
> +            source: "e";
> +            action: STATE_SET "default" 0.0;
> +            target: "fade_clip";
> +         }
> +         program {
> +            name: "disabled";
> +            signal: "e,state,disabled";
> +            source: "e";
> +            action: STATE_SET "faded" 0.0;
> +            target: "fade_clip";
> +         }
> +      }
> +   }
> +#endif
> +
>  /////////////////////////////////////////////////////////////////////////////
>  /*** MOD: IBOX / IBAR ***/
>  
> 
> Modified: trunk/e/data/themes/images/Makefile.am
> ===================================================================
> --- trunk/e/data/themes/images/Makefile.am    2010-11-29 07:07:16 UTC (rev 
> 55053)
> +++ trunk/e/data/themes/images/Makefile.am    2010-11-29 10:52:32 UTC (rev 
> 55054)
> @@ -374,23 +374,12 @@
>  silk.png \
>  slider_clicked.png \
>  slider.png \
> +t0.png \
> +t0-sh.png \
> +t1.png \
> +t1-sh.png \
> +t2.png \
>  tacho_bg.png \
> -tacho_dial_00.png \
> -tacho_dial_01.png \
> -tacho_dial_02.png \
> -tacho_dial_03.png \
> -tacho_dial_04.png \
> -tacho_dial_05.png \
> -tacho_dial_06.png \
> -tacho_dial_07.png \
> -tacho_dial_08.png \
> -tacho_dial_09.png \
> -tacho_dial_10.png \
> -tacho_dial_11.png \
> -tacho_dial_12.png \
> -tacho_dial_13.png \
> -tacho_dial_14.png \
> -tacho_dial_15.png \
>  tacho_fg.png \
>  temp_base.png \
>  temp_mid.png \
> @@ -433,4 +422,4 @@
>  comp-sh1.png \
>  shelf_alt_vert_bg.png \
>  icon_look.png \
> -icon_gadget.png
> \ No newline at end of file
> +icon_gadget.png
> 
> 
> Property changes on: trunk/e/data/themes/images/t0-sh.png
> ___________________________________________________________________
> Added: svn:mime-type
>    + application/octet-stream
> 
> 
> Property changes on: trunk/e/data/themes/images/t0.png
> ___________________________________________________________________
> Added: svn:mime-type
>    + application/octet-stream
> 
> 
> Property changes on: trunk/e/data/themes/images/t1-sh.png
> ___________________________________________________________________
> Added: svn:mime-type
>    + application/octet-stream
> 
> 
> Property changes on: trunk/e/data/themes/images/t1.png
> ___________________________________________________________________
> Added: svn:mime-type
>    + application/octet-stream
> 
> 
> Property changes on: trunk/e/data/themes/images/t2.png
> ___________________________________________________________________
> Added: svn:mime-type
>    + application/octet-stream
> 
> Modified: trunk/e/src/modules/cpufreq/e_mod_main.c
> ===================================================================
> --- trunk/e/src/modules/cpufreq/e_mod_main.c  2010-11-29 07:07:16 UTC (rev 
> 55053)
> +++ trunk/e/src/modules/cpufreq/e_mod_main.c  2010-11-29 10:52:32 UTC (rev 
> 55054)
> @@ -644,6 +644,8 @@
>     FILE *f;
>     int ret = 0;
>     int frequency = 0;
> +   int frequency_min = 0x7fffffff;
> +   int frequency_max = 0;
>     int freqtot = 0;
>  #ifdef __FreeBSD__
>     int len = 4;
> @@ -677,6 +679,8 @@
>            fclose(f);
>            
>            frequency = atoi(buf);
> +          if (frequency > frequency_max) frequency_max = frequency;
> +          if (frequency < frequency_min) frequency_min = frequency;
>            freqtot += frequency;
>            s->active = 1;
>          }
> @@ -685,10 +689,15 @@
>      }
>    if (i < 1) i = 1;
>    frequency = freqtot / i;
> -  if (frequency != s->cur_frequency)
> -    ret = 1;
> +  if (frequency != s->cur_frequency) ret = 1;
> +  if (frequency_min != s->cur_min_frequency) ret = 1;
> +  if (frequency_max != s->cur_max_frequency) ret = 1;
>    s->cur_frequency = frequency;
> +  s->cur_min_frequency = frequency_min;
> +  s->cur_max_frequency = frequency_max;
>    
> +//  printf("%i | %i %i\n", frequency, frequency_min, frequency_max);
> +  
>    // FIXME: this sssumes all cores are on the same governor
>     f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed", "r");
>     if (f)
> @@ -761,10 +770,13 @@
>     Edje_Message_Int_Set *frequency_msg;
>     Edje_Message_String governor_msg;
>  
> -   frequency_msg = malloc(sizeof(Edje_Message_Int_Set) + sizeof(int));
> -   frequency_msg->count = 2;
> +   frequency_msg = malloc(sizeof(Edje_Message_Int_Set) + (sizeof(int) * 4));
> +   frequency_msg->count = 5;
>     frequency_msg->val[0] = cpufreq_config->status->cur_frequency;
>     frequency_msg->val[1] = cpufreq_config->status->can_set_frequency;
> +   frequency_msg->val[2] = cpufreq_config->status->cur_min_frequency;
> +   frequency_msg->val[3] = cpufreq_config->status->cur_max_frequency;
> +   frequency_msg->val[4] = 0; // pad
>     edje_object_message_send(inst->o_cpu, EDJE_MESSAGE_INT_SET, 3,
>                           frequency_msg);
>     free(frequency_msg);
> 
> Modified: trunk/e/src/modules/cpufreq/e_mod_main.h
> ===================================================================
> --- trunk/e/src/modules/cpufreq/e_mod_main.h  2010-11-29 07:07:16 UTC (rev 
> 55053)
> +++ trunk/e/src/modules/cpufreq/e_mod_main.h  2010-11-29 10:52:32 UTC (rev 
> 55054)
> @@ -11,6 +11,8 @@
>     Eina_List     *frequencies;
>     Eina_List     *governors;
>     int            cur_frequency;
> +   int            cur_min_frequency;
> +   int            cur_max_frequency;
>     int            can_set_frequency;
>     char          *cur_governor;
>     const char    *orig_governor;
> 
> 
> ------------------------------------------------------------------------------
> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
> Tap into the largest installed PC base & get more eyes on your game by
> optimizing for Intel(R) Graphics Technology. Get started today with the
> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
> http://p.sf.net/sfu/intelisp-dev2dev
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn

-- 
Gustavo Lima Chaves
Computer Engineer @ ProFUSION Embedded Systems

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to