Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Aayush
purr-data
Commits
a46aad7e
Commit
a46aad7e
authored
Mar 21, 2018
by
Albert Gräf
Browse files
Help browser: Make searchable directories configurable in the GUI prefs.
parent
7dbbbd11
Changes
7
Hide whitespace changes
Inline
Side-by-side
pd/nw/dialog_prefs.html
View file @
a46aad7e
...
...
@@ -302,6 +302,16 @@
<input
type=
"checkbox"
id=
"save_zoom"
name=
"save_zoom"
>
<span
data-i18n=
"prefs.gui.zoom.save_zoom"
></span>
</label>
<br/>
<label
data-i18n=
"[title]prefs.gui.browser.browser_doc_tt"
>
<input
type=
"checkbox"
id=
"browser_doc"
name=
"browser_doc"
>
<span
data-i18n=
"prefs.gui.browser.browser_doc"
></span>
</label>
<br/>
<label
data-i18n=
"[title]prefs.gui.browser.browser_path_tt"
>
<input
type=
"checkbox"
id=
"browser_path"
name=
"browser_path"
>
<span
data-i18n=
"prefs.gui.browser.browser_path"
></span>
</label>
</div>
</div>
...
...
@@ -396,8 +406,8 @@ function get_gui_preset() {
return
document
.
getElementById
(
"
gui_preset
"
).
selectedOptions
[
0
].
value
;
}
function
get_
save_zoom
(
)
{
return
+
document
.
getElementById
(
"
save_zoom
"
).
checked
;
function
get_
bool_elem
(
elem
)
{
return
+
document
.
getElementById
(
elem
).
checked
;
}
// startup config data
...
...
@@ -608,7 +618,7 @@ function apply(save_prefs) {
// Send the gui prefs (currently just the name of the gui preset and the
// status of the save-zoom toggle) to Pd
pdgui
.
pdsend
(
"
pd gui-prefs
"
,
get_gui_preset
(),
get_
save_zoom
(
));
pdgui
.
pdsend
(
"
pd gui-prefs
"
,
get_gui_preset
(),
get_
bool_elem
(
"
save_zoom
"
),
get_bool_elem
(
"
browser_doc
"
),
get_bool_elem
(
"
browser_path
"
));
// Send the startup config data to Pd
pdgui
.
pdsend
.
apply
(
null
,
[
"
pd path-dialog
"
,
startup_use_stdpath
,
startup_verbose
].
concat
(
get_path_array
()));
...
...
@@ -847,7 +857,7 @@ function midi_prefs_callback(attrs) {
pdgui
.
resize_window
(
pd_object_callback
);
}
function
gui_prefs_callback
(
name
,
save_zoom
)
{
function
gui_prefs_callback
(
name
,
save_zoom
,
browser_doc
,
browser_path
)
{
var
s
=
document
.
getElementById
(
"
gui_preset
"
),
i
;
for
(
i
=
0
;
i
<
s
.
options
.
length
;
i
++
)
{
...
...
@@ -857,6 +867,8 @@ function gui_prefs_callback(name, save_zoom) {
}
}
document
.
getElementById
(
"
save_zoom
"
).
checked
=
!!
save_zoom
;
document
.
getElementById
(
"
browser_doc
"
).
checked
=
!!
browser_doc
;
document
.
getElementById
(
"
browser_path
"
).
checked
=
!!
browser_path
;
}
// startup settings
...
...
pd/nw/locales/de/translation.json
View file @
a46aad7e
...
...
@@ -407,6 +407,12 @@
"zoom"
:
{
"save_zoom"
:
"Speichern/Laden der Vergrößerung im Patch"
,
"save_zoom_tt"
:
"Speichere die aktuelle Vergrößerung mit dem Patch und stelle diese beim Laden des Patches wieder her"
},
"browser"
:
{
"browser_doc"
:
"Hilfe-Browser durchsucht nur den doc-Ordner"
,
"browser_doc_tt"
:
"Der Hilfe-Browser durchkämmt nur Hilfe-Patches im doc-Ordner nach Suchbegriffen (schneller)"
,
"browser_path"
:
"Hilfe-Browser durchsucht auch den Hilfe-Pfad"
,
"browser_path_tt"
:
"Der Hilfe-Browser durchkämmt auch Hilfe-Patches im benutzerdefinierten Hilfe-Pfad nach Suchbegriffen (langsamer)"
}
},
"audio"
:
{
...
...
pd/nw/locales/en/translation.json
View file @
a46aad7e
...
...
@@ -408,6 +408,12 @@
"zoom"
:
{
"save_zoom"
:
"save/load zoom level with patch"
,
"save_zoom_tt"
:
"Save the current zoom level with the patch and restore it when reloading the patch"
},
"browser"
:
{
"browser_doc"
:
"help browser only searches the doc folder"
,
"browser_doc_tt"
:
"Only scan help patches in the doc folder for searchable keywords (faster)"
,
"browser_path"
:
"help browser also searches the help path"
,
"browser_path_tt"
:
"Also scan help patches in the user-defined help path for searchable keywords (slower)"
}
},
"audio"
:
{
...
...
pd/nw/pdgui.js
View file @
a46aad7e
...
...
@@ -2,7 +2,7 @@
var
pwd
;
var
lib_dir
;
var
help_path
;
var
help_path
,
browser_doc
,
browser_path
;
var
pd_engine_id
;
exports
.
set_pwd
=
function
(
pwd_string
)
{
...
...
@@ -27,8 +27,10 @@ exports.set_pd_engine_id = function (id) {
exports
.
defunkify_windows_path
=
defunkify_windows_path
;
function
gui_set_help_path
(
helppath
)
{
// post("gui_set_help_path: " + helppath.join(":"));
function
gui_set_browser_config
(
doc_flag
,
path_flag
,
helppath
)
{
// post("gui_set_browser_config: " + helppath.join(":"));
browser_doc
=
doc_flag
;
browser_path
=
path_flag
;
help_path
=
helppath
;
// AG: Start building the keyword index for dialog_search.html. We do this
// here so that we can be sure that lib_dir and help_path are known already.
...
...
@@ -154,7 +156,7 @@ function expand_tilde(filepath) {
// Note that dive() traverses lib_dir asynchronously, so we report back in
// finish_index() when this is done.
function
make_index
()
{
var
doc_path
=
lib_dir
;
var
doc_path
=
browser_doc
?
path
.
join
(
lib_dir
,
"
doc
"
):
lib_dir
;
var
i
=
0
;
var
l
=
help_path
.
length
;
function
make_index_cont
()
{
...
...
@@ -176,7 +178,7 @@ function make_index() {
}
}
post
(
"
building help index in
"
+
doc_path
);
dive
(
doc_path
,
read_file
,
make_index_cont
);
dive
(
doc_path
,
read_file
,
browser_path
?
make_index_cont
:
finish_index
);
}
// AG: This is called from dialog_search.html with a callback that expects to
...
...
@@ -5096,9 +5098,9 @@ function gui_midi_properties(gfxstub, sys_indevs, sys_outdevs,
}
}
function
gui_gui_properties
(
dummy
,
name
,
save_zoom
)
{
function
gui_gui_properties
(
dummy
,
name
,
save_zoom
,
browser_doc
,
browser_path
)
{
if
(
dialogwin
[
"
prefs
"
]
!==
null
)
{
dialogwin
[
"
prefs
"
].
window
.
gui_prefs_callback
(
name
,
save_zoom
);
dialogwin
[
"
prefs
"
].
window
.
gui_prefs_callback
(
name
,
save_zoom
,
browser_doc
,
browser_path
);
}
}
...
...
pd/src/m_glob.c
View file @
a46aad7e
...
...
@@ -75,18 +75,20 @@ static void glob_perf(t_pd *dummy, float f)
sys_perf
=
(
f
!=
0
);
}
extern
int
sys_zoom
;
extern
int
sys_zoom
,
sys_browser_doc
,
sys_browser_path
;
extern
t_symbol
*
sys_gui_preset
;
static
void
glob_gui_prefs
(
t_pd
*
dummy
,
t_symbol
*
s
,
float
f
)
static
void
glob_gui_prefs
(
t_pd
*
dummy
,
t_symbol
*
s
,
float
f
,
float
f2
,
float
f3
)
{
sys_gui_preset
=
s
;
sys_zoom
=
!!
(
int
)
f
;
sys_browser_doc
=
!!
(
int
)
f2
;
sys_browser_path
=
!!
(
int
)
f3
;
}
/* just the gui-preset and the save-zoom toggle for now */
static
void
glob_gui_properties
(
t_pd
*
dummy
)
{
gui_vmess
(
"gui_gui_properties"
,
"xsi"
,
0
,
sys_gui_preset
->
s_name
,
sys_zoom
);
gui_vmess
(
"gui_gui_properties"
,
"xsi
ii
"
,
0
,
sys_gui_preset
->
s_name
,
sys_zoom
,
sys_browser_doc
,
sys_browser_path
);
}
// ths one lives inside g_editor so that it can access the clipboard
...
...
@@ -172,7 +174,7 @@ void glob_init(void)
class_addmethod
(
glob_pdobject
,
(
t_method
)
glob_clipboard_text
,
gensym
(
"clipboardtext"
),
A_FLOAT
,
0
);
class_addmethod
(
glob_pdobject
,
(
t_method
)
glob_gui_prefs
,
gensym
(
"gui-prefs"
),
A_SYMBOL
,
A_FLOAT
,
0
);
gensym
(
"gui-prefs"
),
A_SYMBOL
,
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
0
);
class_addmethod
(
glob_pdobject
,
(
t_method
)
glob_gui_properties
,
gensym
(
"gui-properties"
),
0
);
class_addmethod
(
glob_pdobject
,
(
t_method
)
glob_recent_files
,
...
...
pd/src/s_file.c
View file @
a46aad7e
...
...
@@ -40,7 +40,7 @@
#define snprintf sprintf_s
#endif
int
sys_defeatrt
,
sys_zoom
;
int
sys_defeatrt
,
sys_zoom
,
sys_browser_doc
=
1
,
sys_browser_path
;
t_symbol
*
sys_flags
=
&
s_
;
void
sys_doflags
(
void
);
...
...
@@ -669,6 +669,10 @@ void sys_loadpreferences( void)
sscanf
(
prefbuf
,
"%d"
,
&
sys_defeatrt
);
if
(
sys_getpreference
(
"savezoom"
,
prefbuf
,
MAXPDSTRING
))
sscanf
(
prefbuf
,
"%d"
,
&
sys_zoom
);
if
(
sys_getpreference
(
"browser_doc"
,
prefbuf
,
MAXPDSTRING
))
sscanf
(
prefbuf
,
"%d"
,
&
sys_browser_doc
);
if
(
sys_getpreference
(
"browser_path"
,
prefbuf
,
MAXPDSTRING
))
sscanf
(
prefbuf
,
"%d"
,
&
sys_browser_path
);
if
(
sys_getpreference
(
"guipreset"
,
prefbuf
,
MAXPDSTRING
))
{
char
preset_buf
[
MAXPDSTRING
];
...
...
@@ -808,6 +812,10 @@ void glob_savepreferences(t_pd *dummy)
sys_putpreference
(
"defeatrt"
,
buf1
);
sprintf
(
buf1
,
"%d"
,
sys_zoom
);
sys_putpreference
(
"savezoom"
,
buf1
);
sprintf
(
buf1
,
"%d"
,
sys_browser_doc
);
sys_putpreference
(
"browser_doc"
,
buf1
);
sprintf
(
buf1
,
"%d"
,
sys_browser_path
);
sys_putpreference
(
"browser_path"
,
buf1
);
sys_putpreference
(
"guipreset"
,
sys_gui_preset
->
s_name
);
sys_putpreference
(
"flags"
,
(
sys_flags
?
sys_flags
->
s_name
:
""
));
...
...
pd/src/s_main.c
View file @
a46aad7e
...
...
@@ -285,6 +285,7 @@ void glob_forward_files_from_secondary_instance(void)
}
extern
void
glob_recent_files
(
t_pd
*
dummy
);
extern
int
sys_browser_doc
,
sys_browser_path
;
/* this is called from main() in s_entry.c */
int
sys_main
(
int
argc
,
char
**
argv
)
...
...
@@ -328,7 +329,8 @@ int sys_main(int argc, char **argv)
glob_recent_files
(
0
);
/* AG: send the help path; this must come *after* gui_set_lib_dir so
that the lib_dir is available when help indexing starts */
gui_start_vmess
(
"gui_set_help_path"
,
""
);
gui_start_vmess
(
"gui_set_browser_config"
,
"ii"
,
sys_browser_doc
,
sys_browser_path
);
gui_start_array
();
for
(
nl
=
sys_helppath
;
nl
;
nl
=
nl
->
nl_next
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment