diff --git a/HeeksArt.cpp b/HeeksArt.cpp index a6d1fe9..191be3c 100644 --- a/HeeksArt.cpp +++ b/HeeksArt.cpp @@ -126,7 +126,7 @@ void CHeeksArtApp::OnStartUp(CHeeksCADInterface* h, const wxString& dll_path) heeksCAD->RegisterReadXMLfunction("mesh", CMesh::ReadFromXMLElement); } -void CHeeksArtApp::OnNewOrOpen(bool open) +void CHeeksArtApp::OnNewOrOpen(bool open, int res) { } @@ -146,10 +146,19 @@ void CHeeksArtApp::GetOptions(std::list *list){ void CHeeksArtApp::OnFrameDelete() { } - -const wxString& CHeeksArtApp::GetDllFolder() -{ - return m_dll_path; + +wxString CHeeksArtApp::GetDllFolder() +{ + return m_dll_path; +} + +wxString CHeeksArtApp::GetResFolder() +{ +#if defined(WIN32) || defined(RUNINPLACE) //compile with 'RUNINPLACE=yes make' then skip 'sudo make install' + return m_dll_path; +#else + return (m_dll_path + _T("/../../share/heekscnc")); +#endif } class MyApp : public wxApp diff --git a/HeeksArt.h b/HeeksArt.h index a93660d..02d3e15 100644 --- a/HeeksArt.h +++ b/HeeksArt.h @@ -20,12 +20,13 @@ class CHeeksArtApp{ ~CHeeksArtApp(); void OnStartUp(CHeeksCADInterface* h, const wxString& dll_path); - void OnNewOrOpen(bool open); + void OnNewOrOpen(bool open, int res); void OnInitDLL(); void OnDestroyDLL(); void GetOptions(std::list *list); void OnFrameDelete(); - const wxString& GetDllFolder(); + wxString GetDllFolder(); + wxString GetResFolder(); }; extern CHeeksArtApp theApp; diff --git a/Interface.cpp b/Interface.cpp index 3c4137f..e558ef5 100644 --- a/Interface.cpp +++ b/Interface.cpp @@ -12,9 +12,9 @@ void OnStartUp(CHeeksCADInterface* h, const wxString& dll_path) theApp.OnStartUp(h, dll_path); } -void OnNewOrOpen(int open) +void OnNewOrOpen(int open, int res) { - theApp.OnNewOrOpen(open != 0); + theApp.OnNewOrOpen(open != 0, res); } void GetOptions(void(*callbackfunc)(Property*)) diff --git a/Interface.h b/Interface.h index 747249f..960a209 100644 --- a/Interface.h +++ b/Interface.h @@ -13,7 +13,7 @@ extern "C"{ #endif void HEEKSCNC_EXPORT OnStartUp(CHeeksCADInterface* h, const wxString& dll_path); -void HEEKSCNC_EXPORT OnNewOrOpen(int open); +void HEEKSCNC_EXPORT OnNewOrOpen(int open, int res); void HEEKSCNC_EXPORT GetOptions(void(*callbackfunc)(Property*)); void HEEKSCNC_EXPORT OnFrameDelete(); } diff --git a/Mesh.cpp b/Mesh.cpp index 3ea7d1b..6664aed 100644 --- a/Mesh.cpp +++ b/Mesh.cpp @@ -41,6 +41,13 @@ const CMesh& CMesh::operator=(const CMesh &m){ return *this; } +const wxBitmap &CMesh::GetIcon() +{ + static wxBitmap* icon = NULL; + if(icon == NULL)icon = new wxBitmap(wxImage(theApp.GetResFolder() + _T("/icons/mesh.png"))); + return *icon; +} + void CMesh::DeleteVertices(){ std::map::iterator It; for(It = m_vertices.begin(); It != m_vertices.end(); It++){ @@ -202,7 +209,7 @@ HeeksObj *CMesh::MakeACopy(void)const return new CMesh(*this); } -bool CMesh::ModifyByMatrix(const double *mat){ +void CMesh::ModifyByMatrix(const double *mat){ std::list vertex_list; Matrix tmat(mat); @@ -243,8 +250,6 @@ bool CMesh::ModifyByMatrix(const double *mat){ } DestroyChildDisplayLists(); - - return false; } CMeshFace* CMesh::AddTriangle(const Point& a, const Point& b, const Point& c, const Point& ab, const Point& ba, const Point& bc, const Point& cb, const Point& ca, const Point& ac, const Point& centre){ @@ -404,8 +409,8 @@ class ConvertMeshToTriangles:public Tool{ // Tool's virtual functions const wxChar* GetTitle(){return _("Convert Mesh To Triangles");} void Run(){ - HeeksObj* new_object = mesh_for_tools->ConvertToTriangles(); heeksCAD->CreateUndoPoint(); + HeeksObj* new_object = mesh_for_tools->ConvertToTriangles(); heeksCAD->Add(new_object, NULL); heeksCAD->Remove(mesh_for_tools); heeksCAD->Changed(); diff --git a/Mesh.h b/Mesh.h index 49afed7..2888e3a 100644 --- a/Mesh.h +++ b/Mesh.h @@ -51,8 +51,8 @@ class CMesh : public HeeksObj const wxChar* GetTypeString(void)const{return _("Mesh");} long GetMarkingMask()const{return MARKING_FILTER_UNKNOWN;} // can be selected HeeksObj *MakeACopy(void)const; - wxString GetIcon(){return theApp.GetDllFolder() + _T("/icons/mesh");} - bool ModifyByMatrix(const double *mat); + const wxBitmap &GetIcon(); + void ModifyByMatrix(const double *mat); void GetTools(std::list* t_list, const wxPoint* p); bool Stretch(const double *p, const double* shift, void* data); void Remove(HeeksObj* object); diff --git a/MeshEdge.cpp b/MeshEdge.cpp index 140dbde..f48b58f 100644 --- a/MeshEdge.cpp +++ b/MeshEdge.cpp @@ -28,6 +28,13 @@ CMeshEdge::~CMeshEdge() { } +const wxBitmap &CMeshEdge::GetIcon() +{ + static wxBitmap* icon = NULL; + if(icon == NULL)icon = new wxBitmap(wxImage(theApp.GetResFolder() + _T("/icons/meshedge.png"))); + return *icon; +} + class SplitEdge:public Tool{ public: CMeshEdge* m_e; @@ -138,7 +145,7 @@ void CMeshEdge::GetGripperPositions(std::list *list, bool just_for_end { for(int i = 0; i<2; i++){ Point vt = m_v[i]->vertex(); - list->push_back(GripData(GripperTypeStretch2,vt.x,vt.y,vt.z,NULL)); + list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, false, 1)); } } @@ -146,14 +153,14 @@ void CMeshEdge::GetGripperPositions(std::list *list, bool just_for_end { for(int i = 0; i<2; i++){ Point vt = m_c[i].vertex(); - list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL)); + list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, true)); } } // add a mid point cross for splitting { Point vt = GetMidPoint(); - list->push_back(GripData(GripperTypeStretch3,vt.x,vt.y,vt.z,NULL)); + list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, true, 2)); } } diff --git a/MeshEdge.h b/MeshEdge.h index 5c2977f..77977b5 100644 --- a/MeshEdge.h +++ b/MeshEdge.h @@ -31,7 +31,7 @@ class CMeshEdge:public CMeshChild int GetType()const{return MeshEdgeType;} const wxChar* GetTypeString(void)const{return _("Mesh Edge");} HeeksObj *MakeACopy(void)const; - wxString GetIcon(){return _T("meshedge");} + const wxBitmap &GetIcon(); void GetTools(std::list* t_list, const wxPoint* p); void GetGripperPositions(std::list *list, bool just_for_endof); bool Stretch(const double *p, const double* shift, void* data); diff --git a/MeshFace.cpp b/MeshFace.cpp index 3f55266..0e2eb79 100644 --- a/MeshFace.cpp +++ b/MeshFace.cpp @@ -19,6 +19,13 @@ CMeshFace::~CMeshFace() { } +const wxBitmap &CMeshFace::GetIcon() +{ + static wxBitmap* icon = NULL; + if(icon == NULL)icon = new wxBitmap(wxImage(theApp.GetResFolder() + _T("/icons/meshface.png"))); + return *icon; +} + class RecalcGoodCentre:public Tool{ public: CMeshFace* m_f; @@ -224,7 +231,7 @@ void CMeshFace::GetGripperPositions(std::list *list, bool just_for_end { for(int i = 0; i<3; i++){ Point vt = m_v[i]->vertex(); - list->push_back(GripData(GripperTypeStretch2,vt.x,vt.y,vt.z,NULL)); + list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, false, 1)); } } @@ -232,14 +239,14 @@ void CMeshFace::GetGripperPositions(std::list *list, bool just_for_end for(int i = 0; i<3; i++){ for(int j = 0; j<2; j++){ Point vt = m_e[i]->m_c[j].vertex(); - list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL)); + list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, true)); } } } { Point vt = m_centre.vertex(); - list->push_back(GripData(GripperTypeStretch4,vt.x,vt.y,vt.z,NULL)); + list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, true, 3)); } } diff --git a/MeshFace.h b/MeshFace.h index ecad1f8..54321d7 100644 --- a/MeshFace.h +++ b/MeshFace.h @@ -32,7 +32,7 @@ class CMeshFace:public CMeshChild int GetType()const{return MeshFaceType;} const wxChar* GetTypeString(void)const{return _("Mesh Face");} HeeksObj *MakeACopy(void)const; - wxString GetIcon(){return _T("meshedge");} + const wxBitmap &GetIcon(); void GetGripperPositions(std::list *list, bool just_for_endof); void GetTools(std::list* t_list, const wxPoint* p); bool Stretch(const double *p, const double* shift, void* data); diff --git a/MeshVertex.cpp b/MeshVertex.cpp index 3a443c3..dc3a70d 100644 --- a/MeshVertex.cpp +++ b/MeshVertex.cpp @@ -33,6 +33,13 @@ HeeksObj *CMeshVertex::MakeACopy(void)const return new CMeshVertex(*this); } +const wxBitmap &CMeshVertex::GetIcon() +{ + static wxBitmap* icon = NULL; + if(icon == NULL)icon = new wxBitmap(wxImage(theApp.GetResFolder() + _T("/icons/meshvertex.png"))); + return *icon; +} + class NormalizeAllEdgeDirections:public Tool{ public: CMeshVertex* m_vertex; @@ -154,14 +161,14 @@ void CMeshVertex::NormalizeAllEdgeDirections(){ void CMeshVertex::GetGripperPositions(std::list *list, bool just_for_endof){ // vertex Point vt = vertex(); - list->push_back(GripData(GripperTypeStretch2,vt.x,vt.y,vt.z,NULL)); + list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, false, 1)); for(std::set::iterator It = m_edges.begin(); It != m_edges.end(); It++) { CMeshEdge* edge = *It; CMeshPosition& p = edge->GetControlPointNearVertex(this); vt = p.vertex(); - list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL)); + list->push_back(GripData(GripperTypeStretch,vt.x,vt.y,vt.z,NULL, true, 0)); } } diff --git a/MeshVertex.h b/MeshVertex.h index da98c01..2efe52b 100644 --- a/MeshVertex.h +++ b/MeshVertex.h @@ -37,7 +37,7 @@ class CMeshVertex:public CMeshChild int GetType()const{return MeshVertexType;} const wxChar* GetTypeString(void)const{return _("Mesh Vertex");} HeeksObj *MakeACopy(void)const; - wxString GetIcon(){return _T("meshedge");} + const wxBitmap &GetIcon(); void GetTools(std::list* t_list, const wxPoint* p); void GetGripperPositions(std::list *list, bool just_for_endof); bool Stretch(const double *p, const double* shift, void* data); diff --git a/bitmaps/bitmaps.svg b/bitmaps/bitmaps.svg index 1a24fb5..2600bef 100644 --- a/bitmaps/bitmaps.svg +++ b/bitmaps/bitmaps.svg @@ -10541,7 +10541,10 @@ style="fill:url(#radialGradient6329);fill-opacity:1.0;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 350.34148,244.00738 C 351.30953,212.93132 340.17943,201.89969 310.71916,202.40383 C 309.65564,201.54602 311.29672,243.91325 310.44343,243.84856 C 309.93156,243.80975 320.39411,244.55096 350.34148,244.00738 z" id="path6327" - sodipodi:nodetypes="ccsc" /> + sodipodi:nodetypes="ccsc" + inkscape:export-filename="C:\Users\Dan\HeeksArt\icons\meshface.png" + inkscape:export-xdpi="32.884727" + inkscape:export-ydpi="32.884727" /> + + diff --git a/bitmaps/meshvertex.png b/bitmaps/meshvertex.png new file mode 100644 index 0000000..da91db4 Binary files /dev/null and b/bitmaps/meshvertex.png differ