From: Matthew G. <mat...@us...> - 2007-09-25 14:07:52
|
Update of /cvsroot/jsbsimcommander/src/mattplot In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20874 Modified Files: Condition.cpp Condition.h NomoFrm.cpp NomoFrm.h Table.cpp Table.h plot.cpp plot.h Log Message: update the mattplot curve canvas Index: Table.h =================================================================== RCS file: /cvsroot/jsbsimcommander/src/mattplot/Table.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Table.h 23 Feb 2007 02:29:05 -0000 1.1 --- Table.h 25 Sep 2007 14:07:47 -0000 1.2 *************** *** 55,58 **** --- 55,59 ---- using std::stringstream; using JSBSim::Element; + using JSBSim::FGPropertyManager; namespace Matt{ *************** *** 63,66 **** --- 64,68 ---- typedef vector<Table> TableList; typedef TableList::iterator TableListIter; + typedef TableList::const_iterator TableListCIter; typedef vector<double> DoubleList; *************** *** 99,103 **** /// Constructor ! Table(JSBSim::FGPropertyManager* prop=NULL): dimension(0u), lookupProperty(NULL), --- 101,105 ---- /// Constructor ! Table(FGPropertyManager* prop=NULL): dimension(0u), lookupProperty(NULL), *************** *** 114,118 **** /// The constructor for tables ! static TableList Load(Element* el, JSBSim::FGPropertyManager * prop=NULL); double GetValue(DoubleList keys, bool *flag=NULL); --- 116,120 ---- /// The constructor for tables ! static TableList Load(Element* el, FGPropertyManager * prop=NULL); double GetValue(DoubleList keys, bool *flag=NULL); *************** *** 127,130 **** --- 129,142 ---- string GetNameLabel() const {return label;} + const ValuePairList &GetData() const + { + return Data; + } + + const TablePairList &GetTables() const + { + return Tables; + } + size_t GetSize() const { *************** *** 167,171 **** string indepVar; string indepVarLabel; ! JSBSim::FGPropertyManager *lookupProperty; TablePairList Tables; --- 179,183 ---- string indepVar; string indepVarLabel; ! FGPropertyManager *lookupProperty; TablePairList Tables; *************** *** 177,181 **** unsigned lastIndex; ! JSBSim::FGPropertyManager* PropertyManager; }; --- 189,193 ---- unsigned lastIndex; ! FGPropertyManager* PropertyManager; }; Index: Condition.h =================================================================== RCS file: /cvsroot/jsbsimcommander/src/mattplot/Condition.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Condition.h 23 Feb 2007 02:29:05 -0000 1.1 --- Condition.h 25 Sep 2007 14:07:47 -0000 1.2 *************** *** 82,86 **** void PrintCondition(void); - private: enum eComparison {ecUndef=0, eEQ, eNE, eGT, eGE, eLT, eLE, eMOD}; enum eLogic {elUndef=0, eAND, eOR}; --- 82,85 ---- *************** *** 90,93 **** --- 89,93 ---- FGPropertyManager *TestParam1, *TestParam2, *PropertyManager; //Matt's change here + string property1, property2; float sign1, sign2; double TestValue1, TestValue2; Index: plot.cpp =================================================================== RCS file: /cvsroot/jsbsimcommander/src/mattplot/plot.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** plot.cpp 23 Feb 2007 02:29:05 -0000 1.1 --- plot.cpp 25 Sep 2007 14:07:47 -0000 1.2 *************** *** 10,14 **** #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) ! #pragma implementation "plot.h" #endif --- 10,14 ---- #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) ! #pragma implementation #endif [...5344 lines suppressed...] + { + pen_ctrl->GetPen().SetStyle(wxHORIZONTAL_HATCH ); + } + else if (s == _("VERTICAL_HATCH")) + { + pen_ctrl->GetPen().SetStyle(wxVERTICAL_HATCH ); + } + pen_ctrl->Refresh(); + } + + void PenSettingDialog::OnColour(wxCommandEvent& event) + { + wxColour c = wxGetColourFromUser(this, pen_ctrl->GetPen().GetColour(), _("Colour Setting")); + if (c.IsOk()) + { + pen_ctrl->GetPen().SetColour(c); + pen_ctrl->Refresh(); + } + } + Index: plot.h =================================================================== RCS file: /cvsroot/jsbsimcommander/src/mattplot/plot.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** plot.h 23 Feb 2007 02:29:05 -0000 1.1 --- plot.h 25 Sep 2007 14:07:47 -0000 1.2 *************** *** 23,27 **** #include "input_output/FGPropertyManager.h" using JSBSim::Element; ! using JSBSim::FGPropertyManager; #include "Condition.h" --- 23,32 ---- #include "input_output/FGPropertyManager.h" using JSBSim::Element; ! ! namespace JSBSim ! { ! class FGFunction; ! }; ! using JSBSim::FGFunction; #include "Condition.h" *************** *** 101,105 **** }; - //TODO enum CURVE_TEXT{ CURVE_NO_TEXT, --- 106,109 ---- *************** *** 110,114 **** }; - //TODO enum CURVE_LABEL{ CURVE_LABEL_NONE, --- 114,117 ---- *************** *** 178,185 **** void DrawPoints(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h, double minx, double maxx, double miny, double maxy, AXISDIR axis_dir); - //TODO void DrawText(wxDC& dc, const wxPoint * list, int s); - //TODO wxFont GetFont() const { return fnt; } void SetFont(const wxFont & f) { fnt = f; } --- 181,186 ---- *************** *** 221,225 **** void SetLabel(const wxString & t) { label = t; } - //TODO CURVE_TEXT GetTextPos() const { return text_pos; } void SetTextPos(const CURVE_TEXT & t) { text_pos = t; } --- 222,225 ---- *************** *** 246,249 **** --- 246,254 ---- void Load(Element * element); + /// Export the info from XML file. + void Export(wxTextOutputStream & tstream, const wxString & prefix, const unsigned & n, bool reverse=false) const; + + bool operator != (const Curve & c) const; + /** Init the symbol points. * *************** *** 292,295 **** --- 297,305 ---- bool Load(Element * element); + /** Save graph from file. + * @param filename The XML file of the graph. + */ + void Export(wxTextOutputStream & tstream, const wxString & prefix) const; + /** Get the area to draw based on. * *************** *** 331,335 **** void ExpireCache(void); - //TODO /** Draw the grid on the 'paper'. * --- 341,344 ---- *************** *** 363,376 **** unsigned GetGridW() const { return width; } - /// Set the width of each grid. - void SetGridWidth(const unsigned & s) { grid_width = s; ExpireCache();} - /// Get the height of each grid. unsigned GetGridHeight() const { return grid_height; } unsigned GetGridH() const { return height; } ! /// Set the height of each grid. ! void SetGridHeight(const unsigned & s) { grid_height = s; ExpireCache();} /// Get how many pic to div the grid in x dir. unsigned GetSubGridX() const { return sub_grid_x; } --- 372,391 ---- unsigned GetGridW() const { return width; } /// Get the height of each grid. unsigned GetGridHeight() const { return grid_height; } unsigned GetGridH() const { return height; } ! /// Get how many pic to div the width in x dir. ! unsigned GetGridX() const { return grid_x; } + /// Get how many pic to div the width in x dir. + void SetGridX(const unsigned & s) { grid_x = s; ExpireCache(); } + + /// Get how many pic to div the height in y dir. + unsigned GetGridY() const { return grid_y; } + + /// Get how many pic to div the height in y dir. + void SetGridY(const unsigned & s) { grid_y = s; ExpireCache(); } + /// Get how many pic to div the grid in x dir. unsigned GetSubGridX() const { return sub_grid_x; } *************** *** 387,397 **** /// div info struct PosMap{ ! vector<size_t> row_list; ! vector<size_t> col_list; bool cached; ! vector<wxCoord> row_pos; ! vector<wxCoord> col_pos; ! vector<size_t> row_size; ! vector<size_t> col_size; }; --- 402,412 ---- /// div info struct PosMap{ ! vector<wxUint32> row_list; ! vector<wxUint32> col_list; bool cached; ! vector<wxUint32> row_pos; ! vector<wxUint32> col_pos; ! vector<wxUint32> row_size; ! vector<wxUint32> col_size; }; *************** *** 415,418 **** --- 430,435 ---- unsigned int sub_grid_x; unsigned int sub_grid_y; + unsigned int grid_x; + unsigned int grid_y; wxCoord width; wxCoord height; *************** *** 423,427 **** --- 440,462 ---- class PlotHandler; + class PlotWindow; + + struct Focus{ + PlotWindow * window; + enum Type { + WINDOW = 0x01, + LEGEND = 0x02, + AXISX = 0x04, + AXISY = 0x08, + CURVE = 0x10, + TITLE = 0x20, + GRID = 0x40, + } type; + unsigned iter; + }; + typedef vector<Focus> FocusList; + typedef FocusList::const_iterator FocusListCIter; + typedef FocusList::iterator FocusListIter; /** The window to draw the curves. *************** *** 473,476 **** --- 508,516 ---- bool Load(Element * element); + /** Save graph from file. + * @param filename The XML file of the graph. + */ + void Export(wxTextOutputStream & tstream, const wxString & prefix) const; + /** Draw the plot window. * *************** *** 489,492 **** --- 529,541 ---- void DrawIndicator(wxDC& dc, PosMgr& pos_mgr, wxCoord &xpos, wxCoord &ypos); + /** Draw the focus zone + * + * @param dc The DC to be drawed on. + * @param pos_mgr The positon manager to support pos info. + * @param xpos The x pos of the mouse. + * @param ypos The y pos of the mouse. + */ + void DrawFocus(wxDC& dc, PosMgr& pos_mgr, wxCoord &xpos, wxCoord &ypos, int mask=-1); + /** Set the position of the legend * *************** *** 589,626 **** /// Whether show the legend. ! bool IsShowLegend(const int & no=0) const { return show_legend[no]; } /// Set whether show the legend. ! void ShowLegend(bool b=true, const int & no=0) { show_legend[no] = b; } /// Get the font to draw the legend. ! wxFont GetLegendFont(const int & no=0) const { return fnt_legend[no]; } /// Set the font to draw the legend. ! void SetLegendFont(const wxFont & f, const int & no=0) { fnt_legend[no] = f; } /// Get the pen to draw the legend. ! wxPen GetLegendPen(const int & no=0) const { return pen_legend[no]; } /// Set the pen to draw the legend. ! void SetLegendPen(const wxPen & p, const int & no=0) { pen_legend[no] = p; } /// Get the X pos of the legend. ! double GetLegendPosX(const int & no=0) const { return pos_x_legend[no]; } /// Set the X pos of the legend in the range of [0,1]. ! void SetLegendPosX(const double & x, const int & no=0) { pos_x_legend[no] = x; } /// Get the Y pos of the legend. ! double GetLegendPosY(const int & no=0) const { return pos_y_legend[no]; } /// Set the Y pos of the legend in the range of [0,1]. ! void SetLegendPosY(const double & y, const int & no=0) { pos_y_legend[no] = y; } /// Set the pos of the legend lines out. ! double GetLegendValueX(const int & no=0) const { return value_x_legend[no]; } /// Set the pos of the legend lines out in the range of [0,1]. ! void SetLegendValueX(const double & x, const int & no=0) { value_x_legend[no] = x; } /* Axis info */ --- 638,675 ---- /// Whether show the legend. ! bool IsShowLegend(const int & no=0) const { return legend_list[no].show; } /// Set whether show the legend. ! void ShowLegend(bool b=true, const int & no=0) { legend_list[no].show = b; } /// Get the font to draw the legend. ! wxFont GetLegendFont(const int & no=0) const { return legend_list[no].fnt; } /// Set the font to draw the legend. ! void SetLegendFont(const wxFont & f, const int & no=0) { legend_list[no].fnt = f; } /// Get the pen to draw the legend. ! wxPen GetLegendPen(const int & no=0) const { return legend_list[no].pen; } /// Set the pen to draw the legend. ! void SetLegendPen(const wxPen & p, const int & no=0) { legend_list[no].pen = p; } /// Get the X pos of the legend. ! double GetLegendPosX(const int & no=0) const { return legend_list[no].pos_x; } /// Set the X pos of the legend in the range of [0,1]. ! void SetLegendPosX(const double & x, const int & no=0) { legend_list[no].pos_x = x; } /// Get the Y pos of the legend. ! double GetLegendPosY(const int & no=0) const { return legend_list[no].pos_y; } /// Set the Y pos of the legend in the range of [0,1]. ! void SetLegendPosY(const double & y, const int & no=0) { legend_list[no].pos_y = y; } /// Set the pos of the legend lines out. ! double GetLegendValueX(const int & no=0) const { return legend_list[no].value_x; } /// Set the pos of the legend lines out in the range of [0,1]. ! void SetLegendValueX(const double & x, const int & no=0) { legend_list[no].value_x = x; } /* Axis info */ *************** *** 676,680 **** void SetMinX(const double & min) { min_cx = min; } - //TODO /// Get the X axis mark mode 0: auto; 1:base on interval value; 2: base on list int GetXMarkMode() const { return x_mark_mode; } --- 725,728 ---- *************** *** 790,793 **** --- 838,859 ---- void GetAxisLabelExtent(wxDC &dc, wxCoord &lw, wxCoord &lh); + + struct Legend{ + bool show; + double value_x; + double pos_x; + double pos_y; + wxFont fnt; + wxPen pen; + bool align_left; + bool indicate_left; + wxRect rect; + }; + typedef vector<Legend> LegendList; + typedef LegendList::iterator LegendListIter; + typedef LegendList::const_iterator LegendListCIter; + + LegendList & GetLegendList() {return legend_list;} + protected : /* *************** *** 799,804 **** double getMinX(); ! size_t row_pos; ! size_t col_pos; unsigned mgr_pos; AXISDIR axis_dir; --- 865,870 ---- double getMinX(); ! wxCoord row_pos; ! wxCoord col_pos; unsigned mgr_pos; AXISDIR axis_dir; *************** *** 812,815 **** --- 878,905 ---- Curve * cur_curve; vector<Curve *> curve_list; + bool is_combine_curves; + double combine_curves_distance; + + struct CurvesTag{ + unsigned ns; + FGPropertyManager * property; + vector <FGFunction *> func_list; + Condition * data_condition; + wxString data_full_name; + wxString table_type; + unsigned ne; + wxString xcr; // 2D + wxString base_name; //3D + int from; + bool nofilter; + unsigned dest_num; + wxString coord; //4D + bool strange; + }; + typedef vector<CurvesTag> CurvesTagList; + typedef CurvesTagList::const_iterator CurvesTagListCIter; + typedef CurvesTagList::iterator CurvesTagListIter; + + CurvesTagList curve_tag_list; double distance(Curve * c1, Curve * c2); *************** *** 831,834 **** --- 921,925 ---- vector< double > x_mark_list; wxString str_x_label; + wxRect rect_axis_x; /* *************** *** 846,861 **** vector< double > y_mark_list; wxString str_y_label; /* * legend setting */ ! vector< bool > show_legend; ! vector< double > value_x_legend; ! vector< double > pos_x_legend; ! vector< double > pos_y_legend; ! vector< wxFont > fnt_legend; ! vector< wxPen > pen_legend; ! vector< bool > align_left_legend; ! vector< bool > indicate_left_legend; vector<PlotWindow *> children; --- 937,946 ---- vector< double > y_mark_list; wxString str_y_label; + wxRect rect_axis_y; /* * legend setting */ ! LegendList legend_list; vector<PlotWindow *> children; *************** *** 870,880 **** bool GetIndicatePos(const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h, wxCoord &xpos, wxCoord &ypos, double &xvalue, double &yvalue, Curve *curve); void DrawIndicator(wxDC& dc, const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h, const wxCoord &xpos, const wxCoord &ypos, const double &xvalue, const double &yvalue); bool SelectCurrentCurve(const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h, const wxCoord &xpos, const wxCoord &ypos); void draw_y_axis(wxDC& dc, const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h); void draw_x_axis(wxDC& dc, const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h); void draw_curve(wxDC& dc, const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h); ! void draw_legend(wxDC& dc, const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h, const int & no); ! static void draw_vertical_axis(wxDC& dc, const wxCoord &x, const wxCoord &y, const wxCoord &yh, const double &min, const double &max, vector<double> &mark_list, const wxString & text, const bool &right); ! static void draw_horizon_axis(wxDC& dc, const wxCoord &x, const wxCoord &y, const wxCoord &xh, const double &min, const double &max, vector<double> &mark_list, const wxString & text, const bool &bottom); static void get_interval(double & min, double & max, unsigned int num, double & mark_interval, vector< double > & mark_list); static bool pitch_col(vector<double> &x, vector<double> &y, double &key, vector <unsigned> & list, Table * table, Condition *data_condition, FGPropertyManager *property); --- 955,966 ---- bool GetIndicatePos(const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h, wxCoord &xpos, wxCoord &ypos, double &xvalue, double &yvalue, Curve *curve); void DrawIndicator(wxDC& dc, const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h, const wxCoord &xpos, const wxCoord &ypos, const double &xvalue, const double &yvalue); + void DrawFocus(wxDC& dc, const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h, const wxCoord &xpos, const wxCoord &ypos, int mask=-1); bool SelectCurrentCurve(const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h, const wxCoord &xpos, const wxCoord &ypos); void draw_y_axis(wxDC& dc, const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h); void draw_x_axis(wxDC& dc, const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h); void draw_curve(wxDC& dc, const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h); ! void draw_legend(wxDC& dc, const wxCoord &x, const wxCoord &y, const size_t &w, const size_t &h, LegendListIter & iter); ! static wxRect draw_vertical_axis(wxDC& dc, const wxCoord &x, const wxCoord &y, const wxCoord &yh, const double &min, const double &max, vector<double> &mark_list, const wxString & text, const bool &right); ! static wxRect draw_horizon_axis(wxDC& dc, const wxCoord &x, const wxCoord &y, const wxCoord &xh, const double &min, const double &max, vector<double> &mark_list, const wxString & text, const bool &bottom); static void get_interval(double & min, double & max, unsigned int num, double & mark_interval, vector< double > & mark_list); static bool pitch_col(vector<double> &x, vector<double> &y, double &key, vector <unsigned> & list, Table * table, Condition *data_condition, FGPropertyManager *property); *************** *** 916,919 **** --- 1002,1010 ---- /** + * it will draw the focus zone . + */ + void DrawFocus(wxDC &dc, wxCoord x, wxCoord y, int mask=-1); + + /** * it will reset the position of the legend. */ *************** *** 978,983 **** bool Load(const wxString & filename); ! // TODO ! void Save(); bool IsDrawIndicator(void) const {return isDrawIndicator;} --- 1069,1081 ---- bool Load(const wxString & filename); ! /** Save graph from file. ! * @param filename The XML file of the graph. ! */ ! bool Save(const wxString & filename=wxEmptyString); ! ! /** Save graph from file. ! * @param filename The XML file of the graph. ! */ ! void Export(wxTextOutputStream & tstream, const wxString & prefix) const; bool IsDrawIndicator(void) const {return isDrawIndicator;} *************** *** 1011,1014 **** --- 1109,1115 ---- PosMgr & GetPosMgr() {return pos_mgr;} + void AddFocus(const Focus & f) { focus_list.push_back(f); } + void ClearFocus() { focus_list.clear(); } + protected : *************** *** 1037,1040 **** --- 1138,1142 ---- wxString str_title; wxPen pen_title; + wxRect rect_title; /** *************** *** 1044,1047 **** --- 1146,1151 ---- map<wxString, Table> table_map; + vector<TableList> table_list_list; + vector<TableList> table_list_clist; /** *************** *** 1070,1074 **** void get_paper_size(int &w, int &h); ! DECLARE_EVENT_TABLE() }; --- 1174,1180 ---- void get_paper_size(int &w, int &h); ! ! FocusList focus_list; ! DECLARE_EVENT_TABLE() }; *************** *** 1092,1095 **** --- 1198,1208 ---- ~PlotCanvas(void){}; + enum { + FOCUS_START = 10000, + FONT_START = 10100, + PEN_START = 10200, + SUB_PEN_START = 10300, + }; + // Event Handler Functions. void OnPaint(wxPaintEvent& event); *************** *** 1098,1105 **** --- 1211,1222 ---- void OnMouseLeftDown(wxMouseEvent& event); void OnMouseRightDown(wxMouseEvent& event); + void mkMenu(wxMenu &menu); + void OnFont(wxCommandEvent& event); + void OnPen(wxCommandEvent& event); protected: PlotHandler *handler; int mode; + int mask; int no; DECLARE_EVENT_TABLE() *************** *** 1178,1179 **** --- 1295,1329 ---- + class PenSampleCtrl: public wxWindow { + public : + PenSampleCtrl(const wxPen& pen, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxPanelNameStr); + void SetPen(const wxPen& pen) {m_pen = pen;} + wxPen GetPen() const {return m_pen;} + wxPen& GetPen() {return m_pen;} + + void OnPaint(wxPaintEvent& event); + protected : + wxPen m_pen; + + DECLARE_EVENT_TABLE(); + }; + + class PenSettingDialog: public wxDialog { + public: + /// Constructor + PenSettingDialog(wxWindow* parent, const wxPen & pen); + + wxPen GetPen() const {return pen_ctrl->GetPen();} + void OnWidth(wxCommandEvent& event); + void OnStyle(wxCommandEvent& event); + void OnColour(wxCommandEvent& event); + + protected: + PenSampleCtrl* pen_ctrl; + wxComboBox* combo_box_width; + wxChoice* choice_style; + + DECLARE_EVENT_TABLE(); + }; + + Index: NomoFrm.cpp =================================================================== RCS file: /cvsroot/jsbsimcommander/src/mattplot/NomoFrm.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NomoFrm.cpp 23 Feb 2007 02:29:05 -0000 1.1 --- NomoFrm.cpp 25 Sep 2007 14:07:47 -0000 1.2 *************** *** 9,13 **** #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) ! #pragma implementation "NomoFrame.h" #endif --- 9,13 ---- #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) ! #pragma implementation #endif *************** *** 26,29 **** --- 26,30 ---- #include "NomoFrm.h" + #include "MyApp.h" #include "mattplot/plot.h" *************** *** 42,45 **** --- 43,48 ---- BEGIN_EVENT_TABLE(NomographFrame, wxFrame) EVT_NOTEBOOK_PAGE_CHANGING(XRCID("notebook"), NomographFrame::OnPageChanging) + EVT_MENU(wxID_SAVE, NomographFrame::OnSave) + EVT_MENU(wxID_SAVEAS, NomographFrame::OnSaveAs) END_EVENT_TABLE() *************** *** 76,80 **** PushEventHandler (handler); ! canvas = new PlotCanvas(this, wxID_ANY, handler); wxXmlResource::Get()->AttachUnknownControl(wxT("canvas"), canvas, this); --- 79,83 ---- PushEventHandler (handler); ! canvas = new PlotCanvas(this, wxID_ANY, handler, wxDefaultPosition, wxSize(800,600)); wxXmlResource::Get()->AttachUnknownControl(wxT("canvas"), canvas, this); *************** *** 102,106 **** else if (event.GetOldSelection() == 0) { - static wxString buff; if (buff != handler->GetFileName()) { --- 105,108 ---- *************** *** 115,116 **** --- 117,142 ---- } + void NomographFrame::OnSave(wxCommandEvent& event) + { + buff.Empty(); + event.Skip(); + if (notbook->GetSelection() == 1) + { + if (!text_ctrl_xml->IsModified()) + return; + if (!text_ctrl_xml->SaveFile(handler->GetFileName())) + { + } + if (!handler->Load(handler->GetFileName())) + { + } + buff = handler->GetFileName(); + } + } + + void NomographFrame::OnSaveAs(wxCommandEvent& event) + { + buff.Empty(); + event.Skip(); + } + Index: NomoFrm.h =================================================================== RCS file: /cvsroot/jsbsimcommander/src/mattplot/NomoFrm.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NomoFrm.h 23 Feb 2007 02:29:05 -0000 1.1 --- NomoFrm.h 25 Sep 2007 14:07:47 -0000 1.2 *************** *** 32,36 **** #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) ! #pragma interface "NomographFrm.h" #endif --- 32,36 ---- #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) ! #pragma interface #endif *************** *** 78,84 **** --- 78,87 ---- wxTextCtrl* text_ctrl_xml; wxNotebook* notbook; + wxString buff; public: void OnPageChanging(wxNotebookEvent &event); + void OnSave(wxCommandEvent& event); + void OnSaveAs(wxCommandEvent& event); DECLARE_EVENT_TABLE() }; Index: Table.cpp =================================================================== RCS file: /cvsroot/jsbsimcommander/src/mattplot/Table.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Table.cpp 23 Feb 2007 02:29:05 -0000 1.1 --- Table.cpp 25 Sep 2007 14:07:47 -0000 1.2 *************** *** 45,49 **** #endif using std::istringstream; - using JSBSim::FGPropertyManager; namespace Matt{ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --- 45,48 ---- Index: Condition.cpp =================================================================== RCS file: /cvsroot/jsbsimcommander/src/mattplot/Condition.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Condition.cpp 23 Feb 2007 02:29:05 -0000 1.1 --- Condition.cpp 25 Sep 2007 14:07:47 -0000 1.2 *************** *** 89,93 **** PropertyManager(PropertyManager), isGroup(false) { - string property1, property2, compare_string; Element* condition_element; --- 89,92 ---- |