From 477a62a2a3682b0a8cbd28057ed4c0696103ab04 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Wed, 24 Nov 1999 11:05:20 +0000 Subject: [PATCH] r110: Added a option for using RISC OS mouse bindings to the options box, although it doesn't do much yet (just swaps the same/new window action of buttons 1 & 2) --- ROX-Filer/src/action.c | 2 +- ROX-Filer/src/action.h | 2 +- ROX-Filer/src/apps.c | 2 +- ROX-Filer/src/apps.h | 2 +- ROX-Filer/src/choices.c | 2 +- ROX-Filer/src/choices.h | 2 +- ROX-Filer/src/collection.c | 2 +- ROX-Filer/src/collection.h | 2 +- ROX-Filer/src/dnd.c | 2 +- ROX-Filer/src/dnd.h | 2 +- ROX-Filer/src/filer.c | 70 +++++++++++++++++++++++++++++++++++++++++++-- ROX-Filer/src/filer.h | 2 +- ROX-Filer/src/gui_support.c | 2 +- ROX-Filer/src/gui_support.h | 2 +- ROX-Filer/src/main.c | 2 +- ROX-Filer/src/main.h | 2 +- ROX-Filer/src/menu.c | 2 +- ROX-Filer/src/menu.h | 2 +- ROX-Filer/src/mount.c | 2 +- ROX-Filer/src/mount.h | 2 +- ROX-Filer/src/options.c | 7 +++-- ROX-Filer/src/options.h | 2 +- ROX-Filer/src/pixmaps.c | 2 +- ROX-Filer/src/pixmaps.h | 2 +- ROX-Filer/src/savebox.c | 2 +- ROX-Filer/src/savebox.h | 2 +- ROX-Filer/src/support.c | 2 +- ROX-Filer/src/support.h | 2 +- ROX-Filer/src/type.c | 2 +- ROX-Filer/src/type.h | 2 +- 30 files changed, 100 insertions(+), 33 deletions(-) diff --git a/ROX-Filer/src/action.c b/ROX-Filer/src/action.c index 038be721..e5daa5d6 100644 --- a/ROX-Filer/src/action.c +++ b/ROX-Filer/src/action.c @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/action.h b/ROX-Filer/src/action.h index 85e09f46..f2359ac4 100644 --- a/ROX-Filer/src/action.h +++ b/ROX-Filer/src/action.h @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/apps.c b/ROX-Filer/src/apps.c index b5bac316..bd4ef17e 100644 --- a/ROX-Filer/src/apps.c +++ b/ROX-Filer/src/apps.c @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/apps.h b/ROX-Filer/src/apps.h index d1a3eaa5..f21c6360 100644 --- a/ROX-Filer/src/apps.h +++ b/ROX-Filer/src/apps.h @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/choices.c b/ROX-Filer/src/choices.c index 851b2f6a..a18b8ef9 100644 --- a/ROX-Filer/src/choices.c +++ b/ROX-Filer/src/choices.c @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/choices.h b/ROX-Filer/src/choices.h index db443a1a..70b8754a 100644 --- a/ROX-Filer/src/choices.h +++ b/ROX-Filer/src/choices.h @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * By Thomas Leonard, . diff --git a/ROX-Filer/src/collection.c b/ROX-Filer/src/collection.c index 33bb54ce..3cd134f4 100644 --- a/ROX-Filer/src/collection.c +++ b/ROX-Filer/src/collection.c @@ -1,4 +1,4 @@ -/* vi: set cindent : +/* * $Id$ * * Collection - a GTK+ widget diff --git a/ROX-Filer/src/collection.h b/ROX-Filer/src/collection.h index a35c660b..466fffae 100644 --- a/ROX-Filer/src/collection.h +++ b/ROX-Filer/src/collection.h @@ -1,4 +1,4 @@ -/* vi: set cindent : +/* * $Id$ * * The collection widget provides an area for displaying a collection of diff --git a/ROX-Filer/src/dnd.c b/ROX-Filer/src/dnd.c index 9b770608..98f4bccc 100644 --- a/ROX-Filer/src/dnd.c +++ b/ROX-Filer/src/dnd.c @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/dnd.h b/ROX-Filer/src/dnd.h index 83370c62..753dac3d 100644 --- a/ROX-Filer/src/dnd.h +++ b/ROX-Filer/src/dnd.h @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/filer.c b/ROX-Filer/src/filer.c index d3560e39..995e5205 100644 --- a/ROX-Filer/src/filer.c +++ b/ROX-Filer/src/filer.c @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project @@ -44,6 +44,7 @@ #include "apps.h" #include "mount.h" #include "type.h" +#include "options.h" #define MAX_ICON_HEIGHT 42 #define PANEL_BORDER 2 @@ -55,6 +56,24 @@ GHashTable *path_to_window_list = NULL; static FilerWindow *window_with_selection = NULL; +/* Options bits */ +static GtkWidget *create_options(); +static void update_options(); +static void set_options(); +static void save_options(); +static char *filer_ro_bindings(char *data); + +static OptionsSection options = +{ + "Filer window options", + create_options, + update_options, + set_options, + save_options +}; +static gboolean o_ro_bindings = FALSE; +static GtkWidget *toggle_ro_bindings; + /* Static prototypes */ static void filer_window_destroyed(GtkWidget *widget, FilerWindow *filer_window); @@ -94,6 +113,9 @@ void filer_init() xa_string = gdk_atom_intern("STRING", FALSE); path_to_window_list = g_hash_table_new(g_str_hash, g_str_equal); + + options_sections = g_slist_prepend(options_sections, &options); + option_register("filer_ro_bindings", filer_ro_bindings); } @@ -757,7 +779,8 @@ void open_item(Collection *collection, if (event->type == GDK_2BUTTON_PRESS || event->type == GDK_BUTTON_PRESS) { shift = event->state & GDK_SHIFT_MASK; - adjust = event->button != 1 || event->state & GDK_CONTROL_MASK; + adjust = (event->button != (o_ro_bindings ? 2 : 1)) + ^ ((event->state & GDK_CONTROL_MASK) != 0); } else { @@ -1070,3 +1093,46 @@ void filer_opendir(char *path, gboolean panel, Side panel_side) add_view(filer_window); scan_dir(filer_window); } + +/* Build up some option widgets to go in the options dialog, but don't + * fill them in yet. + */ +static GtkWidget *create_options() +{ + GtkWidget *vbox; + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 4); + + toggle_ro_bindings = + gtk_check_button_new_with_label("Use RISC OS mouse bindings"); + gtk_box_pack_start(GTK_BOX(vbox), toggle_ro_bindings, FALSE, TRUE, 0); + + return vbox; +} + +/* Reflect current state by changing the widgets in the options box */ +static void update_options() +{ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle_ro_bindings), + o_ro_bindings); +} + +/* Set current values by reading the states of the widgets in the options box */ +static void set_options() +{ + o_ro_bindings = gtk_toggle_button_get_active( + GTK_TOGGLE_BUTTON(toggle_ro_bindings)); +} + +static void save_options() +{ + option_write("filer_ro_bindings", o_ro_bindings ? "1" : "0"); +} + +static char *filer_ro_bindings(char *data) +{ + o_ro_bindings = atoi(data) != 0; + return NULL; +} + diff --git a/ROX-Filer/src/filer.h b/ROX-Filer/src/filer.h index 62747981..14cd786f 100644 --- a/ROX-Filer/src/filer.h +++ b/ROX-Filer/src/filer.h @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/gui_support.c b/ROX-Filer/src/gui_support.c index f52e1d37..18901c63 100644 --- a/ROX-Filer/src/gui_support.c +++ b/ROX-Filer/src/gui_support.c @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/gui_support.h b/ROX-Filer/src/gui_support.h index a558e5b8..54c87b2e 100644 --- a/ROX-Filer/src/gui_support.h +++ b/ROX-Filer/src/gui_support.h @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/main.c b/ROX-Filer/src/main.c index 30e7656d..1703ea3c 100644 --- a/ROX-Filer/src/main.c +++ b/ROX-Filer/src/main.c @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/main.h b/ROX-Filer/src/main.h index f395efae..ff1d9a4d 100644 --- a/ROX-Filer/src/main.h +++ b/ROX-Filer/src/main.h @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/menu.c b/ROX-Filer/src/menu.c index 57e72456..12820600 100644 --- a/ROX-Filer/src/menu.c +++ b/ROX-Filer/src/menu.c @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/menu.h b/ROX-Filer/src/menu.h index 40dd2eea..74e66c7d 100644 --- a/ROX-Filer/src/menu.h +++ b/ROX-Filer/src/menu.h @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/mount.c b/ROX-Filer/src/mount.c index 702887ea..6b99fa1d 100644 --- a/ROX-Filer/src/mount.c +++ b/ROX-Filer/src/mount.c @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/mount.h b/ROX-Filer/src/mount.h index 450c8277..51549496 100644 --- a/ROX-Filer/src/mount.h +++ b/ROX-Filer/src/mount.h @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/options.c b/ROX-Filer/src/options.c index 130e379d..37e942cd 100644 --- a/ROX-Filer/src/options.c +++ b/ROX-Filer/src/options.c @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project @@ -183,9 +183,10 @@ void parse_file(char *path, ParseFunc *parse_line) } } -/* Call this on init to register a handler for a key. +/* Call this on init to register a handler for a key (thing before the = in + * the config file). * The function returns a pointer to an error messages (which will - * NOT be free()d, or NULL on success. + * NOT be free()d), or NULL on success. */ void option_register(char *key, OptionFunc *func) { diff --git a/ROX-Filer/src/options.h b/ROX-Filer/src/options.h index f07beb8f..61a600f5 100644 --- a/ROX-Filer/src/options.h +++ b/ROX-Filer/src/options.h @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/pixmaps.c b/ROX-Filer/src/pixmaps.c index bf67d492..8723a2fc 100644 --- a/ROX-Filer/src/pixmaps.c +++ b/ROX-Filer/src/pixmaps.c @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/pixmaps.h b/ROX-Filer/src/pixmaps.h index d3e375b2..5df0f5c9 100644 --- a/ROX-Filer/src/pixmaps.h +++ b/ROX-Filer/src/pixmaps.h @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/savebox.c b/ROX-Filer/src/savebox.c index 4424f544..98581610 100644 --- a/ROX-Filer/src/savebox.c +++ b/ROX-Filer/src/savebox.c @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/savebox.h b/ROX-Filer/src/savebox.h index 80e31e53..b3bbd639 100644 --- a/ROX-Filer/src/savebox.h +++ b/ROX-Filer/src/savebox.h @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/support.c b/ROX-Filer/src/support.c index edebeccd..e55b513e 100644 --- a/ROX-Filer/src/support.c +++ b/ROX-Filer/src/support.c @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/support.h b/ROX-Filer/src/support.h index 809f6cf0..2a8bdbd5 100644 --- a/ROX-Filer/src/support.h +++ b/ROX-Filer/src/support.h @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/type.c b/ROX-Filer/src/type.c index 87366f19..4688641e 100644 --- a/ROX-Filer/src/type.c +++ b/ROX-Filer/src/type.c @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project diff --git a/ROX-Filer/src/type.h b/ROX-Filer/src/type.h index 348d22e1..53a28a0b 100644 --- a/ROX-Filer/src/type.h +++ b/ROX-Filer/src/type.h @@ -1,4 +1,4 @@ -/* vi: set cindent: +/* * $Id$ * * ROX-Filer, filer for the ROX desktop project -- 2.11.4.GIT