Skip to content

Commit

Permalink
clean up for 3.3.7 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecil committed Mar 5, 2019
1 parent 9bf4f7d commit 25b2a8b
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 19 deletions.
41 changes: 41 additions & 0 deletions Tests/cache/cache.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion make/darwin/yosemite/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions shoes/native/gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
8 changes: 4 additions & 4 deletions shoes/native/gtk/gtkfixedalt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 7 additions & 2 deletions shoes/types/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions shoes/types/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ typedef struct {
VALUE extra1;
VALUE extra2;
VALUE osx_menutrim;
VALUE image_cache;
} shoes_settings;

typedef struct {
Expand Down
13 changes: 8 additions & 5 deletions shoes/world.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions shoes/world.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 16 additions & 1 deletion static/manual-en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 25b2a8b

Please sign in to comment.