diff --git a/Tests/cache/cache.rb b/Tests/cache/cache.rb new file mode 100644 index 00000000..6f8247b2 --- /dev/null +++ b/Tests/cache/cache.rb @@ -0,0 +1,41 @@ +Shoes.app do + require 'shoes/data' + require 'shoes/image' + stack do + flow do + #@el = edit_line "#{DIR}/static/shoes-icon-walkabout.png" + @el = edit_line "https://shoes.mvmanila.com/public/images/dino.jpg" + @cb = check; para "Cached?" + button "(Re)load" do + @img.clear + @img.append do + image @el.text, cache: @cb.checked + end + end + button "Show external cache" do + @cview.clear + @cview.append do + eb = edit_box width: 400 + DATABASE.each do |key, value| + eb.append "#{key} -> #{value}" + end + end + end + button "clear all caches" do + app.cache_clear :all + quit if confirm "Please restart Shoes for best results" + end + para "Global cache: " + @sw = switch width: 80 do |n| + app.cache = n.active? + @cb.checked = n.active? + end + end + @img = flow {} + @cview = flow {} + end + start do + @sw.active = app.cache + @cb.checked = app.cache + end +end diff --git a/make/darwin/yosemite/env.rb b/make/darwin/yosemite/env.rb index a2e6c65a..866cc056 100644 --- a/make/darwin/yosemite/env.rb +++ b/make/darwin/yosemite/env.rb @@ -88,7 +88,7 @@ DLEXT = "dylib" #LINUX_CFLAGS << " -DSHOES_QUARTZ -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -fpascal-strings #{RbConfig::CONFIG["CFLAGS"]} -x objective-c -fobjc-exceptions" -LINUX_CFLAGS << " -DVIDEO -DSHOES_QUARTZ -Wall -fpascal-strings -x objective-c -fobjc-exceptions" +LINUX_CFLAGS << " -DVIDEO -DSHOES_QUARTZ -DSHOES_FORCE_RADIO -Wall -fpascal-strings -x objective-c -fobjc-exceptions" if ENV['CDEFS'] LINUX_CFLAGS << " #{ENV['CDEFS']}" end diff --git a/shoes/native/gtk.c b/shoes/native/gtk.c index 294ec1e6..3331441b 100644 --- a/shoes/native/gtk.c +++ b/shoes/native/gtk.c @@ -86,13 +86,13 @@ int shoes_gtk_set_desktop() { static VALUE shoes_make_font_list(FcFontSet *fonts, VALUE ary) { int i = 0; - printf("fontconfig says %d fonts\n", fonts->nfont); + //printf("fontconfig says %d fonts\n", fonts->nfont); for (i = 0; i < fonts->nfont; i++) { FcValue val; FcPattern *p = fonts->fonts[i]; if (FcPatternGet(p, FC_FAMILY, 0, &val) == FcResultMatch) { rb_ary_push(ary, rb_str_new2((char *)val.u.s)); - printf("fc says %s\n", (char *)val.u.s); + //printf("fc says %s\n", (char *)val.u.s); } } rb_funcall(ary, rb_intern("uniq!"), 0); @@ -2217,8 +2217,8 @@ static void shoes_canvas_gtk_size_menu(GtkWidget *widget, GtkAllocation *size, g } -/* TODO sort of fixes bug #349 depends on gtk 3.12 or higher (Boo Windows) - * seems like overkill or incomplete +/* TODO: sort of fixes bug #349 depends on gtk 3.12 or higher (Boo Windows) + * seems like overkill or incomplete - it gets called a lot. */ gboolean shoes_app_gtk_configure_menu(GtkWidget *widget, GdkEvent *evt, gpointer data) { shoes_app *app = (shoes_app *)data; @@ -2395,13 +2395,14 @@ shoes_code shoes_native_app_open_menu(shoes_app *app, char *path, int dialog, sh gtk_window_set_resizable(GTK_WINDOW(window), FALSE); } else if (app->minwidth < app->width || app->minheight < app->height + app->mb_height) { GdkGeometry hints; - hints.min_width = app->minwidth; - hints.min_height = app->minheight + app->mb_height; + hints.min_width = max(app->minwidth, 100); + hints.min_height = max(app->minheight + app->mb_height, 100); #ifdef SZBUG fprintf(stderr,"resize hints: %d, %d\n", hints.min_width, hints.min_height); #endif gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &hints, GDK_HINT_MIN_SIZE); + //gtk_window_set_resizable(GTK_WINDOW(window), TRUE); // no help with szbug } gtk_window_set_default_size(GTK_WINDOW(window), app->width, app->height + app->mb_height); diff --git a/shoes/native/gtk/gtkfixedalt.c b/shoes/native/gtk/gtkfixedalt.c index d2a56610..8b72a22a 100644 --- a/shoes/native/gtk/gtkfixedalt.c +++ b/shoes/native/gtk/gtkfixedalt.c @@ -91,8 +91,8 @@ gtkfixed_alt_get_preferred_width(GtkWidget *widget, int *minimal, int *natural) GtKFixed_AltPrivate *priv = GTKFIXED_ALT_PRIVATE(fixed); *minimal = 1; //*minimal = priv->shoes_width; - //*natural = 1; - *natural = priv->shoes_width; + *natural = 1; + //*natural = priv->shoes_width; #ifdef Nothing fprintf(stderr,"fixed_pref_wid %d, %d\n",*minimal,*natural); #endif @@ -109,8 +109,8 @@ gtkfixed_alt_get_preferred_height(GtkWidget *widget, int *minimal, int *natural) GtKFixed_AltPrivate *priv = GTKFIXED_ALT_PRIVATE(fixed); *minimal = 1; //*minimal = priv->shoes_height; - //*natural = 1; - *natural = priv->shoes_height; + *natural = 1; + //*natural = priv->shoes_height; #ifdef Nothing fprintf(stderr,"fixed_pref_hgt %d, %d\n",*minimal,*natural); #endif diff --git a/shoes/types/settings.c b/shoes/types/settings.c index ca350937..080189cd 100644 --- a/shoes/types/settings.c +++ b/shoes/types/settings.c @@ -52,6 +52,7 @@ VALUE shoes_settings_alloc(VALUE klass) { st->extra1 = Qnil; st->extra2 = Qnil; st->osx_menutrim = Qnil; + st->image_cache = Qtrue; return obj; } @@ -60,7 +61,7 @@ VALUE shoes_settings_alloc(VALUE klass) { * Save in a global ruby object - not a Shoes GUI object. * There is a one time, small bit of memory that is not free-ed. */ - +extern int shoes_cache_setting; VALUE shoes_settings_new(shoes_yaml_init *yml) { shoes_settings *st; Data_Get_Struct(shoes_world->settings, shoes_settings, st); @@ -105,7 +106,11 @@ VALUE shoes_settings_new(shoes_yaml_init *yml) { st->osx_menutrim = Qtrue; else st->osx_menutrim = Qfalse; - + + if (! strcmp(yml->image_cache, "false")) { + st->image_cache = Qnil; + shoes_cache_setting = 0; + } //free(yml); return shoes_world->settings; } diff --git a/shoes/types/settings.h b/shoes/types/settings.h index 15c2a4f2..26782397 100644 --- a/shoes/types/settings.h +++ b/shoes/types/settings.h @@ -24,6 +24,7 @@ typedef struct { VALUE extra1; VALUE extra2; VALUE osx_menutrim; + VALUE image_cache; } shoes_settings; typedef struct { diff --git a/shoes/world.c b/shoes/world.c index 457a49e4..f898ff5b 100644 --- a/shoes/world.c +++ b/shoes/world.c @@ -270,6 +270,7 @@ int shoes_init_load_yaml(char *path) { shoes_config_yaml->extra1 = NULL; shoes_config_yaml->extra2 = NULL; shoes_config_yaml->osx_menutrim = "false"; + shoes_config_yaml->image_cache = "true"; // check current dir (script location) first FILE* fh = fopen("startup.yaml", "r"); @@ -320,11 +321,13 @@ int shoes_init_load_yaml(char *path) { datap = &shoes_config_yaml->extra1; } else if (!strcmp(tk,"Extra2")) { datap = &shoes_config_yaml->extra2; - } else if (!strcmp(tk,"OSX_Menu_Trim")) { - datap = &shoes_config_yaml->osx_menutrim; - } else if (!strcmp(tk,"Display_Backend")) { - datap = &shoes_config_yaml->backend; - } else { + } else if (!strcmp(tk, "Image_Cache")) { + datap = &shoes_config_yaml->image_cache; + } else if (!strcmp(tk,"OSX_Menu_Trim")) { + datap = &shoes_config_yaml->osx_menutrim; + } else if (!strcmp(tk,"Display_Backend")) { + datap = &shoes_config_yaml->backend; + } else { printf("Unrecognised key: %s\n", tk); return 0; } diff --git a/shoes/world.h b/shoes/world.h index 57a75661..a855b249 100644 --- a/shoes/world.h +++ b/shoes/world.h @@ -102,6 +102,7 @@ typedef struct _shoes_yaml_init { char* extra1; char* extra2; char* osx_menutrim; + char* image_cache; } shoes_yaml_init; extern shoes_yaml_init *shoes_config_yaml; diff --git a/static/manual-en.txt b/static/manual-en.txt index ca7ac8bd..ebbeb14c 100644 --- a/static/manual-en.txt +++ b/static/manual-en.txt @@ -5987,7 +5987,7 @@ Returns the current setting. === settings.wintmo = integer === -Only for Window. Integer is the number of milliseconds for the mainloop +Only for the Windows platform. Integer is the number of milliseconds for the mainloop timeout (tmo). This controls how frequently time is given to backgound Ruby threads. The default value is 10 which is a good balance of responsiveness for things like animating a progress bar with a download - download use threads. If you have a long @@ -6009,6 +6009,21 @@ names , comma separated, of the backends. 'x11' is the default. Unless you know better, this field should not be set and 'wayland' is the only value that works. If you have a wayland backend. + +=== settings Image_Cache === + +The Image_Cache: setting in startup.yaml does not have a Settings class method. You +can use the app.methods to get or change the value. The only value is `Image_Cache: false` +to turn off the default. + +=== settings OSX_Menu_Trim === + +This only exists in startup.yaml. There is no method to query the setting. +`OSX_Menu_Trim: true` in startup.yaml will not display the Shoes entries of +Open, Manual, Cobbler, Package and Profile" in the global menubar for OSX. This +might be useful when your packaged app doesn't want to to show all that could be +done. + == Terminal == Sometimes you want a logging window or even a window you can read keystrokes