~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmithContribItems/wxchart/wxschart.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
* along with wxSmith; if not, write to the Free Software
17
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
18
18
*
19
 
* $Revision: 4564 $
20
 
* $Id: wxschart.cpp 4564 2007-10-26 20:33:02Z byo $
21
 
* $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/src/plugins/contrib/wxSmithContribItems/wxchart/wxschart.cpp $
 
19
* $Revision: 5961 $
 
20
* $Id: wxschart.cpp 5961 2009-12-08 06:24:32Z mortenmacfly $
 
21
* $HeadURL: svn+ssh://jenslody@svn.berlios.de/svnroot/repos/codeblocks/trunk/src/plugins/contrib/wxSmithContribItems/wxchart/wxschart.cpp $
22
22
*/
23
23
 
24
24
#include "wxschart.h"
104
104
            if ( StyleCode.IsEmpty() ) StyleCode = _T("0");
105
105
            else                       StyleCode.RemoveLast();
106
106
 
 
107
            #if wxCHECK_VERSION(2, 9, 0)
 
108
            Codef(_T("%C(%W,%I,(STYLE)(%s),%P,%S,%T);\n"),StyleCode.wx_str());
 
109
            #else
107
110
            Codef(_T("%C(%W,%I,(STYLE)(%s),%P,%S,%T);\n"),StyleCode.c_str());
 
111
            #endif
108
112
 
109
113
            Codef(_T("{\n"));
110
114
            for ( size_t i=0; i<m_ChartPointsDesc.Count(); i++ )
129
133
 
130
134
                wxString VarStr = wxString::Format(_T("PointSet%d"),(int)i);
131
135
 
 
136
                #if wxCHECK_VERSION(2, 9, 0)
 
137
                Codef(_T("\twxChartPoints* %v = %s(%t);\n"),VarStr.wx_str(),GenStr.wx_str(),Desc->Name.wx_str());
 
138
                #else
132
139
                Codef(_T("\twxChartPoints* %v = %s(%t);\n"),VarStr.c_str(),GenStr.c_str(),Desc->Name.c_str());
 
140
                #endif
133
141
 
134
142
                for ( size_t j=0; j<Desc->Points.Count(); j++ )
135
143
                {
136
144
                    wxString PointStr = wxString::Format(_T("%lf,%lf"),Desc->Points[j]->X,Desc->Points[j]->Y);
 
145
                    #if wxCHECK_VERSION(2, 9, 0)
 
146
                    Codef(_T("\t%v->Add(%t,%s);\n"),VarStr.wx_str(),Desc->Points[j]->Name.wx_str(),PointStr.wx_str());
 
147
                    #else
137
148
                    Codef(_T("\t%v->Add(%t,%s);\n"),VarStr.c_str(),Desc->Points[j]->Name.c_str(),PointStr.c_str());
 
149
                    #endif
138
150
                }
139
151
 
 
152
                #if wxCHECK_VERSION(2, 9, 0)
 
153
                Codef(_T("\t%AAdd(%v);\n"),VarStr.wx_str());
 
154
                #else
140
155
                Codef(_T("\t%AAdd(%v);\n"),VarStr.c_str());
 
156
                #endif
141
157
            }
142
158
            Codef(_T("}\n"));
143
159
 
153
169
{
154
170
    long RealFlags = m_Flags;
155
171
    if ( RealFlags & DEFAULT_STYLE_FIX ) RealFlags |= DEFAULT_STYLE;
156
 
    wxChartCtrl* Chart = new wxChartCtrl(Parent,GetId(),(STYLE)RealFlags,Pos(Parent),Size(Parent),Style());
 
172
    wxChartCtrl* Chart = new wxChartCtrl(Parent,GetId(),(wxChartStyle)RealFlags,Pos(Parent),Size(Parent),Style());
157
173
 
158
174
    for ( size_t i=0; i<m_ChartPointsDesc.Count(); i++ )
159
175
    {
195
211
 
196
212
void wxsChart::OnAddExtraProperties(wxsPropertyGridManager* Grid)
197
213
{
 
214
    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
 
215
    Grid->SelectPage(0);
 
216
    #else
198
217
    Grid->SetTargetPage(0);
199
 
 
 
218
    #endif
 
219
 
 
220
 
 
221
    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
 
222
    m_ChartPointsCountId = Grid->Append(new wxIntProperty(_("Number of data sets"),wxPG_LABEL,
 
223
    #else
200
224
    m_ChartPointsCountId = Grid->Append(wxIntProperty(_("Number of data sets"),wxPG_LABEL,
 
225
    #endif
201
226
                                                      (int)m_ChartPointsDesc.Count()));
202
227
 
203
228
    for ( int i=0; i<(int)m_ChartPointsDesc.Count(); i++ )
210
235
 
211
236
void wxsChart::OnExtraPropertyChanged(wxsPropertyGridManager* Grid,wxPGId Id)
212
237
{
 
238
    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
 
239
    Grid->SelectPage(0);
 
240
    #else
213
241
    Grid->SetTargetPage(0);
 
242
    #endif
214
243
 
215
244
    if ( Id == m_ChartPointsCountId )
216
245
    {
237
266
            // We have to remove some entries
238
267
            for ( int i=NewValue; i<OldValue; i++ )
239
268
            {
 
269
                #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
 
270
                Grid->DeleteProperty(m_ChartPointsDesc[i]->Id);
 
271
                #else
240
272
                Grid->Delete(m_ChartPointsDesc[i]->Id);
 
273
                #endif
241
274
                delete m_ChartPointsDesc[i];
242
275
            }
243
276
 
344
377
    ChartPointsDesc* Desc = m_ChartPointsDesc[Position];
345
378
    wxString SetName = wxString::Format(_("Set %d"),Position+1);
346
379
 
 
380
    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
 
381
    Desc->Id = Grid->Append(new wxParentProperty(SetName,wxPG_LABEL));
 
382
    #else
347
383
    Desc->Id = Grid->Append(wxParentProperty(SetName,wxPG_LABEL));
 
384
    #endif
348
385
 
349
386
    static const wxChar* Types[] =
350
387
    {
359
396
        Bar, Bar3D, Pie, Pie3D, Points, Points3D, Line, Line3D, Area, Area3D
360
397
    };
361
398
 
 
399
    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
 
400
    Desc->TypeId = Grid->AppendIn(Desc->Id,new wxEnumProperty(_("Type"),wxPG_LABEL,Types,Values,Desc->Type));
 
401
    Desc->NameId = Grid->AppendIn(Desc->Id,new wxStringProperty(_("Name"),wxPG_LABEL,Desc->Name));
 
402
    Desc->PointsCountId = Grid->AppendIn(Desc->Id,new wxIntProperty(_("Number of points"),wxPG_LABEL,(int)Desc->Points.Count()));
 
403
    #else
362
404
    Desc->TypeId = Grid->AppendIn(Desc->Id,wxEnumProperty(_("Type"),wxPG_LABEL,Types,Values,Desc->Type));
363
405
    Desc->NameId = Grid->AppendIn(Desc->Id,wxStringProperty(_("Name"),wxPG_LABEL,Desc->Name));
364
406
    Desc->PointsCountId = Grid->AppendIn(Desc->Id,wxIntProperty(_("Number of points"),wxPG_LABEL,(int)Desc->Points.Count()));
 
407
    #endif
365
408
 
366
409
    for ( int i=0; i<(int)Desc->Points.Count(); i++ )
367
410
    {
415
458
        {
416
459
            for ( int i=NewValue; i<OldValue; i++ )
417
460
            {
 
461
                #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
 
462
                Grid->DeleteProperty((Desc->Points[i])->Id);
 
463
                #else
418
464
                Grid->Delete((Desc->Points[i])->Id);
 
465
                #endif
419
466
                delete Desc->Points[i];
420
467
            }
421
468
 
451
498
    PointDesc* Desc = SetDesc->Points[Position];
452
499
    wxString Name = wxString::Format(_("Point %d"),Position+1);
453
500
 
 
501
    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
 
502
    Desc->Id = Grid->AppendIn(SetDesc->Id,new wxParentProperty(Name,wxPG_LABEL));
 
503
    Desc->NameId = Grid->AppendIn(Desc->Id,new wxStringProperty(_("Name"),wxPG_LABEL,Desc->Name));
 
504
    Desc->XId = Grid->AppendIn(Desc->Id,new wxStringProperty(_("X"),wxPG_LABEL,wxString::Format(_T("%lf"),Desc->X)));
 
505
    Desc->YId = Grid->AppendIn(Desc->Id,new wxStringProperty(_("Y"),wxPG_LABEL,wxString::Format(_T("%lf"),Desc->Y)));
 
506
    #else
454
507
    Desc->Id = Grid->AppendIn(SetDesc->Id,wxParentProperty(Name,wxPG_LABEL));
455
508
    Desc->NameId = Grid->AppendIn(Desc->Id,wxStringProperty(_("Name"),wxPG_LABEL,Desc->Name));
456
509
    Desc->XId = Grid->AppendIn(Desc->Id,wxStringProperty(_("X"),wxPG_LABEL,wxString::Format(_T("%lf"),Desc->X)));
457
510
    Desc->YId = Grid->AppendIn(Desc->Id,wxStringProperty(_("Y"),wxPG_LABEL,wxString::Format(_T("%lf"),Desc->Y)));
 
511
    #endif
458
512
}
459
513
 
460
514
bool wxsChart::HandleChangeInPoint(wxsPropertyGridManager* Grid,wxPGId Id,ChartPointsDesc* SetDesc,int Position,bool Global)