summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2013-12-21 02:43:38 +0100
committerOle Loots <ole@monochrom.net>2013-12-21 02:43:38 +0100
commit9118f3c8cc37cf2902c78f12c8b676d911653573 (patch)
tree7a8331724e64c7d68ce06f4350a8a1287233a51a
parentb4cef781eff108e79cf210b6b6881de2dfed1681 (diff)
downloadnetsurf-9118f3c8cc37cf2902c78f12c8b676d911653573.tar.gz
netsurf-9118f3c8cc37cf2902c78f12c8b676d911653573.tar.bz2
Added "select file/path" buttons to path configuration groupbox.
-rwxr-xr-xatari/res/netsurf.rscbin38236 -> 38346 bytes
-rwxr-xr-xatari/res/netsurf.rsh5
-rwxr-xr-xatari/res/netsurf.rsm11
-rw-r--r--atari/settings.c102
4 files changed, 92 insertions, 26 deletions
diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc
index 84e70d27c..a88910210 100755
--- a/atari/res/netsurf.rsc
+++ b/atari/res/netsurf.rsc
Binary files differ
diff --git a/atari/res/netsurf.rsh b/atari/res/netsurf.rsh
index 5ae722e52..68ecf64f4 100755
--- a/atari/res/netsurf.rsh
+++ b/atari/res/netsurf.rsh
@@ -134,6 +134,11 @@
#define SETTINGS_EDIT_CA_BUNDLE 7 /* FTEXT in tree SETTINGS */
#define SETTINGS_EDIT_CA_CERTS_PATH 8 /* FTEXT in tree SETTINGS */
#define SETTINGS_EDIT_EDITOR 9 /* FTEXT in tree SETTINGS */
+#define SETTINGS_BT_SEL_DOWNLOAD_DIR 96 /* BUTTON in tree SETTINGS */
+#define SETTINGS_BT_SEL_HOTLIST 97 /* BUTTON in tree SETTINGS */
+#define SETTINGS_BT_SEL_CA_BUNDLE 98 /* BUTTON in tree SETTINGS */
+#define SETTINGS_BT_SEL_CA_CERTS 99 /* BUTTON in tree SETTINGS */
+#define SETTINGS_BT_SEL_EDITOR 100 /* BUTTON in tree SETTINGS */
/* Make sure that initial value is large enough! */
#define SETTINGS_BT_SEL_FONT_RENDERER 16 /* BUTTON in tree SETTINGS */
#define SETTINGS_CB_ANTI_ALIASING 17 /* BUTTON in tree SETTINGS */
diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm
index 5b7168633..ff647d197 100755
--- a/atari/res/netsurf.rsm
+++ b/atari/res/netsurf.rsm
@@ -3,7 +3,7 @@ ResourceMaster v3.651
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
#R 0@0@1@1@2@1@
-#M 11110100@0@7728@660@
+#M 11110100@0@7728@662@
#T 0@2@TOOLBAR@@20@@
#O 1@20@AREA_SEARCH@@
#O 2@26@BT_SEARCH_FWD@@
@@ -112,7 +112,7 @@ ResourceMaster v3.651
#T 15@2@TOOLBAR_HISTORY@@1@@
#T 16@2@TOOLBAR_SSL_CERT@@2@@
#O 1@26@TRUSTED@@
-#T 17@2@SETTINGS@@96@@
+#T 17@2@SETTINGS@@101@@
#O 1@26@SAVE@@
#O 2@26@ABORT@@
#O 5@29@EDIT_DOWNLOAD_PATH@@
@@ -120,6 +120,11 @@ ResourceMaster v3.651
#O 7@29@EDIT_CA_BUNDLE@@
#O 8@29@EDIT_CA_CERTS_PATH@@
#O 9@29@EDIT_EDITOR@@
+#O 96@26@BT_SEL_DOWNLOAD_DIR@@
+#O 97@26@BT_SEL_HOTLIST@@
+#O 98@26@BT_SEL_CA_BUNDLE@@
+#O 99@26@BT_SEL_CA_CERTS@@
+#O 100@26@BT_SEL_EDITOR@@
#O 16@26@BT_SEL_FONT_RENDERER@Make sure that initial value is large enough!@
#O 17@26@CB_ANTI_ALIASING@@
#O 18@26@CB_TRANSPARENCY@@
@@ -209,4 +214,4 @@ ResourceMaster v3.651
#O 61@28@M_CHOICES@@
#O 62@28@M_VLOG@@
#O 64@28@M_HELP_CONTENT@@
-#c 4908@
+#c 3798@
diff --git a/atari/settings.c b/atari/settings.c
index b16e274a8..30ad20a13 100644
--- a/atari/settings.c
+++ b/atari/settings.c
@@ -91,7 +91,7 @@ static const char *gui_timeouts[] = {
#define INPUT_PROXY_PORT_MAX_LEN 5
#define INPUT_MIN_REFLOW_PERIOD_MAX_LEN 4
#define LABEL_FONT_RENDERER_MAX_LEN 8
-#define LABEL_PATH_MAX_LEN 43
+#define LABEL_PATH_MAX_LEN 40
#define LABEL_ICONSET_MAX_LEN 8
#define INPUT_TOOLBAR_COLOR_MAX_LEN 6
@@ -322,6 +322,76 @@ static void display_settings(void)
toggle_objects();
}
+static bool handle_filesystem_select_button(short rsc_bt)
+{
+ bool require_path = false;
+ bool is_folder = false;
+ short rsc_te = 0; // The textarea that is bound to the button
+ const char * title = "";
+ const char * path = NULL;
+
+ // TODO: localize String:
+ switch (rsc_bt) {
+
+
+ case SETTINGS_BT_SEL_DOWNLOAD_DIR:
+ title = "Select Download Directory:";
+ rsc_te = SETTINGS_EDIT_DOWNLOAD_PATH;
+ require_path = true;
+ break;
+
+ case SETTINGS_BT_SEL_HOTLIST:
+ title = "Select Hotlist File:";
+ rsc_te = SETTINGS_EDIT_HOTLIST_FILE;
+ break;
+
+ case SETTINGS_BT_SEL_CA_BUNDLE:
+ title = "Select CA Bundle File:";
+ rsc_te = SETTINGS_EDIT_CA_BUNDLE;
+ break;
+
+ case SETTINGS_BT_SEL_CA_CERTS:
+ title = "Select Certs Directory:";
+ rsc_te = SETTINGS_EDIT_CA_CERTS_PATH;
+ require_path = true;
+ break;
+
+ case SETTINGS_BT_SEL_EDITOR:
+ title = "Select Editor Application:";
+ rsc_te = SETTINGS_EDIT_EDITOR;
+ break;
+
+ default:
+ break;
+ };
+
+ assert(rsc_te != 0);
+
+ if (require_path == false) {
+ path = file_select(title, "");
+ gemtk_obj_set_str_safe(dlgtree, rsc_te, path);
+ }
+ else {
+ do {
+ /* display file selector: */
+ path = file_select(title, "");
+ if (path) {
+ is_folder = is_dir(path);
+ }
+ if ((is_folder == false) && (path != NULL)) {
+ gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, "Folder Required!");
+ }
+ } while ((is_folder == false) && (path != NULL));
+
+ if ((is_folder == true) && (path != NULL)) {
+ gemtk_obj_set_str_safe(dlgtree, rsc_te, path);
+ }
+ }
+
+ OBJ_REDRAW(rsc_bt);
+ OBJ_REDRAW(rsc_te);
+}
+
static void form_event(int index, int external)
{
char spare[255];
@@ -486,28 +556,14 @@ static void form_event(int index, int external)
OBJ_REDRAW(SETTINGS_BT_GUI_TOUT);
break;
- /*
- case SETTINGS_INPUT_TOOLBAR_BGCOLOR:
- objc_offset( FORM(win), SETTINGS_INPUT_TOOLBAR_BGCOLOR, &x, &y );
- choice = color_popup(x, y, tmp_option_atari_toolbar_bg);
- snprintf( spare, 255, "%06x", choice );
- tmp_option_atari_toolbar_bg = choice;
- ObjcStrCpy( dlgtree, SETTINGS_INPUT_TOOLBAR_BGCOLOR,
- spare );
- is_button = true;
- OBJ_REDRAW(SETTINGS_INPUT_TOOLBAR_BGCOLOR);
- break;
- */
- /*
- case SETTINGS_BT_TOOLBAR_ICONSET:
- objc_offset( FORM(win), SETTINGS_BT_TOOLBAR_ICONSET, &x, &y );
- tmp = toolbar_iconset_popup(x,y);
- if( tmp != NULL ){
- ObjcStrCpy( dlgtree, SETTINGS_BT_TOOLBAR_ICONSET, tmp );
- }
- is_button = true;
- break;
- */
+ case SETTINGS_BT_SEL_DOWNLOAD_DIR:
+ case SETTINGS_BT_SEL_HOTLIST:
+ case SETTINGS_BT_SEL_CA_BUNDLE:
+ case SETTINGS_BT_SEL_CA_CERTS:
+ case SETTINGS_BT_SEL_EDITOR:
+ handle_filesystem_select_button(index);
+ break;
+
case SETTINGS_INC_MEM_CACHE:
case SETTINGS_DEC_MEM_CACHE:
if( index == SETTINGS_DEC_MEM_CACHE )