foobar2000 SDK  2015-01-14
threaded_process.cpp
Go to the documentation of this file.
1 #include "foobar2000.h"
2 
4 {
6 }
7 
9 {
11 }
12 
14 {
15  if (p_state < 0.0) set_progress(progress_min);
16  else if (p_state < 1.0) set_progress( progress_min + (t_size)(p_state * (progress_max - progress_min)));
18 }
19 
21 {
22  if (p_state < 0.0) set_progress_secondary(progress_min);
23  else if (p_state < 1.0) set_progress_secondary( progress_min + (t_size)(p_state * (progress_max - progress_min)));
25 }
26 
27 
28 bool threaded_process::g_run_modal(service_ptr_t<threaded_process_callback> p_callback,unsigned p_flags,HWND p_parent,const char * p_title,t_size p_title_len)
29 {
30  return static_api_ptr_t<threaded_process>()->run_modal(p_callback,p_flags,p_parent,p_title,p_title_len);
31 }
32 
33 bool threaded_process::g_run_modeless(service_ptr_t<threaded_process_callback> p_callback,unsigned p_flags,HWND p_parent,const char * p_title,t_size p_title_len)
34 {
35  return static_api_ptr_t<threaded_process>()->run_modeless(p_callback,p_flags,p_parent,p_title,p_title_len);
36 }
37 
39  static const GUID guid_preventStandby = { 0x7aafeffb, 0x5f11, 0x483f, { 0xac, 0x65, 0x61, 0xec, 0x9c, 0x70, 0x37, 0x4e } };
40  advconfig_entry_checkbox::ptr obj;
41  if (advconfig_entry::g_find_t(obj, guid_preventStandby)) {
42  return obj->get_state();
43  } else {
44  return false;
45  }
46 }
Definition: pfc.h:53
virtual void set_progress_secondary(t_size p_state)=0
Sets the secondary progress bar state; scale from progress_min to progress_max.
static bool g_run_modal(service_ptr_t< threaded_process_callback > p_callback, unsigned p_flags, HWND p_parent, const char *p_title, t_size p_title_len=~0)
Helper invoking run_modal().
t_size MulDiv_Size(t_size x, t_size y, t_size z)
Definition: int_types.h:52
void set_progress_secondary_float(double p_state)
Helper; sets secondary progress with a float 0..1 scale.
virtual bool run_modeless(service_ptr_t< threaded_process_callback > p_callback, unsigned p_flags, HWND p_parent, const char *p_title, t_size p_title_len=~0)=0
Runs an asynchronous threaded_process operation.
static bool g_run_modeless(service_ptr_t< threaded_process_callback > p_callback, unsigned p_flags, HWND p_parent, const char *p_title, t_size p_title_len=~0)
Helper invoking run_modeless().
static bool g_find_t(outptr &out, const GUID &id)
Definition: advconfig.h:18
size_t t_size
Definition: int_types.h:48
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
virtual void set_progress(t_size p_state)=0
Sets the primary progress bar state; scale from progress_min to progress_max.
Helper template used to easily access core services. Usage: static_api_ptr_t api; api->doso...
Definition: service.h:533
virtual bool run_modal(service_ptr_t< threaded_process_callback > p_callback, unsigned p_flags, HWND p_parent, const char *p_title, t_size p_title_len=~0)=0
Runs a synchronous threaded_process operation - the function does not return until the operation has ...
void set_progress_float(double p_state)
Helper; sets primary progress with a float 0..1 scale.
static bool g_query_preventStandby()
Queries user settings; returns whether various timeconsuming tasks should be blocking machine standby...