Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef WAVEPACKET_VGFX_UTIL_H__
00036 #define WAVEPACKET_VGFX_UTIL_H__
00037
00038
00039 #include "vgfx.h"
00040
00041 #include "graph/dag.h"
00042
00043
00044
00045
00046
00047
00048 namespace vgfx {
00049
00050
00051
00052
00053 class NodeChecker {
00054 public:
00055 virtual ~NodeChecker(void) throw();
00056 virtual bool checkNode(IN visit_result_t& vr) { return false; }
00057 bool operator()(IN visit_result_t& vr) { return this->checkNode(vr); }
00058 };
00059
00060
00061
00062
00063
00064 const char * getDragDropRootNodeID(void) throw();
00065
00066
00067
00068
00069 void getDragRequest(IN ObjectMap * map,
00070 IN Primitive * root,
00071 IN const SetString& selection,
00072 IN float x_cm,
00073 IN float y_cm,
00074 OUT std::string& request);
00075
00076
00077
00078
00079 bool getDropRequest(IN ObjectMap * map,
00080 IN Primitive * root,
00081 IN const SetString& selection,
00082 IN std::istream& drag_request,
00083 IN float x_cm,
00084 IN float y_cm,
00085 IN NodeChecker& okayToReceiveDrop,
00086 OUT std::string& request,
00087 OUT SetString& out_selection);
00088
00089
00090
00091 void getSelectionRect(IN ObjectMap * map,
00092 IN Primitive * root,
00093 IN const SetString& selection,
00094 OUT rect_t& r_cm);
00095
00096
00097
00098
00099 void addDependenciesToGraph(IN ObjectMap * map,
00100 IN const char * id,
00101 IO graph::DAG * dag);
00102
00103
00104 struct hit_result_t {
00105 hit_result_t(void) throw() { this->clear(); }
00106 void clear(void) throw() {
00107 p = NULL;
00108 tag_path = "";
00109 T.setIdentity();
00110 }
00111
00112
00113 Primitive *p;
00114 std::string tag_path;
00115 xform_2d_t T;
00116 float x;
00117 float y;
00118 };
00119
00120 bool getObjectAt(IN Primitive * root,
00121 IN float x_cm,
00122 IN float y_cm,
00123 IN NodeChecker& checker,
00124 OUT hit_result_t& hr);
00125
00126
00127
00128 struct meta_check_t {
00129 meta_check_t(void) throw() { this->clear(); }
00130 void clear(void) throw() {
00131 exists = false;
00132 value.clear();
00133 }
00134
00135 operator bool(void) const throw() { return exists; }
00136 const char * c_str(void) const throw() { return value.c_str(); }
00137
00138
00139 std::string value;
00140 bool exists;
00141 };
00142
00143 meta_check_t getMeta(IN Primitive * p, IN const char * name);
00144 std::string getOptionalMeta(IN Primitive * p,
00145 IN const char * name,
00146 IN const char * default_value);
00147
00148
00149
00150
00151
00152
00153
00154 class MetaKeyValueChecker : public NodeChecker {
00155 public:
00156 ~MetaKeyValueChecker(void) throw();
00157 MetaKeyValueChecker(IN const char * key, IN const char * value);
00158 bool checkNode(IN visit_result_t& vr);
00159 private:
00160 std::string m_key;
00161 std::string m_value;
00162 };
00163
00164
00165 };
00166
00167 #endif // WAVEPACKET_VGFX_UTIL_H__
00168