Graphite
Version 3
An experimental 3D geometry processing program
|
Base class for Application. More...
#include <OGF/scene_graph/skin/application_base.h>
Classes | |
class | ApplicationBaseLoggerClient |
A LoggerClient that redirects all messages to an ApplicationBase. More... | |
class | ApplicationBaseProgressClient |
A ProgressClient that redirects all messages to an ApplicationBase. More... | |
Public Member Functions | |
ApplicationBase (Interpreter *interpreter=nullptr) | |
ApplicationBase constructor. More... | |
~ApplicationBase () override | |
ApplicationBase destructor. | |
Interpreter * | interpreter () |
Gets the main Interpreter. More... | |
for (size_t index=tooltip_.find("\\n");index !=std::string::npos;index=tooltip_.find("\\n", index+2)) | |
const std::string & | get_tooltip () const |
Gets the tooltip to be displayed near the cursor in the rendering area, or an empty string if there is no tooltip. | |
virtual void | stop () |
Stops the application. More... | |
virtual void | set_style (const std::string &value) |
Sets the style to be used for widgets. More... | |
virtual void | set_font_size (index_t value) |
Sets the size of fonts in the application. More... | |
void | declare_preference_variable (const std::string &name, const std::string &value, const std::string &help="") |
Declares a preference variable. More... | |
virtual void | save_preferences () |
Saves the preferences to home directory / graphite.ini. | |
virtual void | load_preferences (const std::string &filename) |
Loads preference variables from a file. More... | |
virtual bool | preferences_loaded () |
Tests whether preferences were loaded. More... | |
virtual void | cancel_current_job () |
Cancels the current job. More... | |
virtual void | draw () |
Redraws the main window. More... | |
virtual void | update () |
Indicates that the main window should be redrawn. | |
virtual void | begin () |
ProgressClient overload, callback called by ProgressTask. More... | |
virtual void | progress (index_t step, index_t percent) |
ProgressClient overload, callback called by ProgressTask. More... | |
virtual void | end (bool canceled) |
ProgressClient overload, callback called by ProgressTask. More... | |
std::string | find_file (const std::string &filename) const |
Finds a file in the OGF_PATH. More... | |
virtual void | save_state () |
Saves state before applying command or tool, for undo()/redo(). | |
virtual void | undo () |
Restores last saved state if available. | |
virtual void | redo () |
Restores next saved state if available. | |
virtual void | progress_cancel () |
Cancels current progress tastk. | |
virtual void | post_draw () |
Called after each frame. | |
bool | get_can_redo () const |
Tests whether redo() can be called. More... | |
void | div (const std::string &value) |
A signal that is triggered when a 'separation div' should be displayed in the logger. More... | |
void | out (const std::string &value) |
A signal that is triggered when the logger displays a message. More... | |
void | warn (const std::string &value) |
A signal that is triggered when the logger displays a warning message. More... | |
void | err (const std::string &value) |
A signal that is triggered when the logger displays an error message. More... | |
void | status (const std::string &value) |
A signal that is triggered when the message in the status bar should be updated. More... | |
void | notify_progress_begin (const std::string &value) |
A signal that is triggered when a ProgressTask starts. More... | |
void | notify_progress (index_t value) |
A signal that is triggered when a ProgressTask is updated. More... | |
void | notify_progress_end () |
A signal that is triggered when a ProgressTask finishes. | |
Public Member Functions inherited from OGF::Object | |
Object (bool transient=false) | |
Object constructor. More... | |
virtual | ~Object () |
Object destructor. | |
virtual MetaClass * | meta_class () const |
Gets the meta class. More... | |
virtual void | set_meta_class (MetaClass *mclass) |
Sets the meta class. More... | |
unsigned int | id () const |
Gets the identifier of this object. More... | |
std::string | string_id () const |
Gets the unique string identifier. More... | |
bool | has_method (const std::string &method_name) const |
Tests whether a method is defined. More... | |
virtual bool | invoke_method (const std::string &method_name, const ArgList &args, Any &ret_val) |
Invokes a method by method name and argument list, and gets the return value. More... | |
bool | invoke_method (const std::string &method_name, const ArgList &args) |
Invokes a method by method name and argument list. More... | |
bool | invoke_method (const std::string &method_name) |
Invokes a method by method name. More... | |
bool | has_property (const std::string &prop_name) const |
Tests whether a property is defined. More... | |
virtual bool | get_property (const std::string &prop_name, std::string &prop_value) const |
Gets a property. More... | |
virtual Connection * | connect_signal_to_slot (const std::string &signal_name, Object *to, const std::string &slot_name) |
Connects a signal with a slot of another object. More... | |
virtual void | add_connection (Connection *connection) |
Adds a connection to this object. More... | |
virtual void | remove_connection (Connection *connection) |
Removes a connection to this object. More... | |
virtual void | get_element (index_t i, Any &value) const |
Gets an element by index. More... | |
virtual void | set_element (index_t i, const Any &value) |
Sets an element by index. More... | |
virtual void | search (const std::string &needle, const std::string &path="") |
Displays the names of all objects that contain a substring. More... | |
bool | get_signals_enabled () const |
Tests wheter signals are enabled. More... | |
void | set_signals_enabled (bool value) |
Enables or disables signals. More... | |
bool | get_slots_enabled () const |
Tests wheter slots are enabled. More... | |
void | set_slots_enabled (bool value) |
Enables or disables slots. More... | |
MetaClass * | get_meta_class () const |
Gets the meta class. More... | |
std::string | get_string_id () const |
Gets the unique string identifier. More... | |
virtual std::string | get_doc () const |
Gets the documentation. More... | |
virtual Sign | compare (const Object *other) const |
Compares this object with another one. More... | |
virtual bool | is_a (const MetaType *type) const |
Tests whether this object inherits a given type. More... | |
void | disconnect () |
Removes all connections from signals of this objects. More... | |
void | enable_signals () |
Enables signals. | |
void | disable_signals () |
Disables signals. | |
void | enable_slots () |
Enables slots. | |
void | disable_slots () |
Disables slots. | |
void | set_properties (const ArgList &args) |
Sets several properties in a single call. More... | |
virtual bool | set_property (const std::string &name, const std::string &value) |
Sets an individual property. More... | |
void | help () const |
Displays some help about this object. More... | |
virtual bool | set_property (const std::string &name, const Any &value) |
Sets an individual property. More... | |
virtual bool | get_property (const std::string &prop_name, Any &prop_value) const |
Gets a property. More... | |
Public Member Functions inherited from GEO::Counted | |
void | ref () const |
Increments the reference count. More... | |
void | unref () const |
Decrements the reference count. More... | |
bool | is_shared () const |
Check if the object is shared. More... | |
int | nb_refs () const |
Gets the number of references that point to this object. More... | |
Static Public Member Functions | |
static ApplicationBase * | instance () |
static bool | is_stopping () |
Tests whether the application is stopping. More... | |
Static Public Member Functions inherited from OGF::Object | |
static Object * | id_to_object (unsigned int id) |
Gets an object from a unique object id. More... | |
Static Public Member Functions inherited from GEO::Counted | |
static void | ref (const Counted *counted) |
Increments the reference count. More... | |
static void | unref (const Counted *counted) |
Decrements the reference count. More... | |
Public Attributes | |
__pad0__: void set_tooltip(const std::string& x) { tooltip_ = x | |
__pad1__: virtual void start() | |
__pad2__: bool get_can_undo() const | |
gom_signals | __pad3__: void started() |
Public Attributes inherited from OGF::Object | |
__pad0__: virtual index_t get_nb_elements() const | |
__pad1__: bool equals(const Object* other) const | |
Protected Member Functions | |
virtual void | save_state_to_file (const std::string &filename) |
Saves Graphite state to a file. | |
virtual void | load_state_from_file (const std::string &filename) |
Saves Graphite state to a file. | |
std::string | state_buffer_filename (index_t i) const |
Gets the file name to be used to store a state buffer. More... | |
Protected Member Functions inherited from OGF::Object | |
virtual bool | emit_signal (const std::string &signal_name, const ArgList &args, bool called_from_slot=false) |
Emits a signal and calls the slots it is connected to. More... | |
Protected Member Functions inherited from GEO::Counted | |
Counted () | |
Creates a reference counted object. More... | |
virtual | ~Counted () |
Destroys a reference counted object. More... | |
Static Protected Member Functions | |
static void | set_stopping_flag () |
Indicates that the application is stopping, i.e. processes the last events from the event queue. More... | |
Protected Attributes | |
Interpreter * | interpreter_ |
LoggerClient_var | logger_client_ |
ProgressClient_var | progress_client_ |
std::string | tooltip_ |
index_t | state_buffer_begin_ |
index_t | state_buffer_end_ |
index_t | state_buffer_size_ |
index_t | state_buffer_current_ |
bool | undo_redo_called_ |
bool | started_callback_called_ |
Static Protected Attributes | |
static ApplicationBase * | instance_ |
static bool | stopping_ |
Base class for Application.
Contains all the toolkit-independent material.
Definition at line 58 of file application_base.h.
OGF::ApplicationBase::ApplicationBase | ( | Interpreter * | interpreter = nullptr | ) |
ApplicationBase constructor.
[in] | interpreter | a pointer to the main Interpreter. |
|
virtual |
ProgressClient overload, callback called by ProgressTask.
Called when a ProgressTask starts.
|
virtual |
Cancels the current job.
This function is called when the 'stop' button near the progress bar is pushed.
void OGF::ApplicationBase::declare_preference_variable | ( | const std::string & | name, |
const std::string & | value, | ||
const std::string & | help = "" |
||
) |
Declares a preference variable.
[in] | name | the name of the variable. |
[in] | value | the default value to be used, if the variable does not already exist in the environment. |
[in] | help | the optional help string. |
void OGF::ApplicationBase::div | ( | const std::string & | value | ) |
A signal that is triggered when a 'separation div' should be displayed in the logger.
Overloads LoggerClient::div()
[in] | value | the name of the 'separation div' |
|
virtual |
Redraws the main window.
This function is called by commands that animate objects during computation, by the progress bar and by console output.
Reimplemented in OGF::Application.
|
virtual |
ProgressClient overload, callback called by ProgressTask.
Called when a ProgressTask is terminated.
[in] | canceled | indicates whether the ProgressTask was interupted by the user. |
void OGF::ApplicationBase::err | ( | const std::string & | value | ) |
A signal that is triggered when the logger displays an error message.
Overloads LoggerClient::err()
[in] | value | the message to be displayed. |
std::string OGF::ApplicationBase::find_file | ( | const std::string & | filename | ) | const |
Finds a file in the OGF_PATH.
bool OGF::ApplicationBase::get_can_redo | ( | ) | const |
Tests whether redo() can be called.
true | if undo is activated and there is a saved state \false otherwise |
|
inline |
Gets the main Interpreter.
Definition at line 76 of file application_base.h.
|
inlinestatic |
Tests whether the application is stopping.
When the application is stopping, it processes the last events from the queue before exiting the event loop. Some event handlers need to test this flag in order to avoid sending new events (else the application will be never able to stop).
true | if the application is stopping |
false | otherwise |
Definition at line 346 of file application_base.h.
|
virtual |
Loads preference variables from a file.
[in] | filename | the full path to the file. |
Reimplemented in OGF::Application.
void OGF::ApplicationBase::notify_progress | ( | index_t | value | ) |
A signal that is triggered when a ProgressTask is updated.
[in] | value | the value of the progress, in percent. |
void OGF::ApplicationBase::notify_progress_begin | ( | const std::string & | value | ) |
A signal that is triggered when a ProgressTask starts.
[in] | value | the name of the ProgressTask |
void OGF::ApplicationBase::out | ( | const std::string & | value | ) |
A signal that is triggered when the logger displays a message.
Overloads LoggerClient::out()
[in] | value | the message to be displayed. |
|
virtual |
Tests whether preferences were loaded.
This function returns false if there was no user defined graphite.ini preferences file.
true | if preferences were loaded. |
false | otherwise. |
ProgressClient overload, callback called by ProgressTask.
Called when a ProgressTask is updated.
[in] | step | current step |
[in] | percent | current percentage |
|
virtual |
Sets the size of fonts in the application.
Default implementation does nothing but storing the font size in the preferences. Can be overloaded in implementations.
[in] | value | the size of fonts |
Reimplemented in OGF::Application.
|
inlinestaticprotected |
Indicates that the application is stopping, i.e. processes the last events from the event queue.
Implementations of the application class are supposed to set the stopping flag, then process the last events from the event queue, then exit the event loop.
Definition at line 383 of file application_base.h.
|
virtual |
Sets the style to be used for widgets.
Some toolkits can have different styles. Default implementation does nothing but storing the style in the preferences. Can be overloaded in implementations.
[in] | value | the name of the widgets style |
Reimplemented in OGF::Application.
|
protected |
Gets the file name to be used to store a state buffer.
Used by undo() / redo(). State buffers are stored as .graphite files, that store the scene graph and the complete state of Graphite.
[in] | i | the index of the state buffer |
void OGF::ApplicationBase::status | ( | const std::string & | value | ) |
A signal that is triggered when the message in the status bar should be updated.
[in] | value | the message to be displayed. |
|
virtual |
Stops the application.
In derived classes, it exits the main event loop of the widgets toolkit.
Reimplemented in OGF::Application.
void OGF::ApplicationBase::warn | ( | const std::string & | value | ) |
A signal that is triggered when the logger displays a warning message.
Overloads LoggerClient::warn()
[in] | value | the message to be displayed. |