~ubuntu-branches/ubuntu/utopic/pgadmin3/utopic-proposed

« back to all changes in this revision

Viewing changes to pgadmin/ogl/ogldiag.cpp

  • Committer: Package Import Robot
  • Author(s): Christoph Berg
  • Date: 2013-09-10 16:16:38 UTC
  • mfrom: (1.3.4)
  • Revision ID: package-import@ubuntu.com-20130910161638-wwup1q553ylww7dr
Tags: 1.18.0-1
* New upstream release.
* Don't install /usr/bin/png2c anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
// pgAdmin III - PostgreSQL Tools
4
4
//
5
5
// Portions Copyright (C) 1998 - 2011, Julian Smart
6
 
// Portions Copyright (C) 2011 - 2012, The pgAdmin Development Team
 
6
// Portions Copyright (C) 2011 - 2013, The pgAdmin Development Team
7
7
// This software is released under the PostgreSQL Licence
8
8
//
9
9
// ogldiag.cpp - wxDiagram
208
208
        wxExprDatabase *database = new wxExprDatabase;
209
209
 
210
210
        // First write the diagram type
211
 
        wxExpr *header = new wxExpr(_T("diagram"));
 
211
        wxExpr *header = new wxExpr(wxT("diagram"));
212
212
        OnHeaderSave(*database, *header);
213
213
 
214
214
        database->Append(header);
222
222
                {
223
223
                        wxExpr *expr;
224
224
                        if (shape->IsKindOf(CLASSINFO(wxLineShape)))
225
 
                                expr = new wxExpr(_T("line"));
 
225
                                expr = new wxExpr(wxT("line"));
226
226
                        else
227
 
                                expr = new wxExpr(_T("shape"));
 
227
                                expr = new wxExpr(wxT("shape"));
228
228
 
229
229
                        OnShapeSave(*database, *shape, *expr);
230
230
                }
281
281
{
282
282
        wxBeginBusyCursor();
283
283
 
284
 
        wxExprDatabase database(wxExprInteger, _T("id"));
 
284
        wxExprDatabase database(wxExprInteger, wxT("id"));
285
285
        if (!database.Read(filename))
286
286
        {
287
287
                wxEndBusyCursor();
291
291
        DeleteAllShapes();
292
292
 
293
293
        database.BeginFind();
294
 
        wxExpr *header = database.FindClauseByFunctor(_T("diagram"));
 
294
        wxExpr *header = database.FindClauseByFunctor(wxT("diagram"));
295
295
 
296
296
        if (header)
297
297
                OnHeaderLoad(database, *header);
302
302
        {
303
303
                wxExpr *clause = (wxExpr *)node->GetData();
304
304
                long id = -1;
305
 
                clause->GetAttributeValue(_T("id"), id);
 
305
                clause->GetAttributeValue(wxT("id"), id);
306
306
                wxRegisterId(id);
307
307
                node = node->GetNext();
308
308
        }
322
322
{
323
323
        // Find and create the node images
324
324
        database.BeginFind();
325
 
        wxExpr *clause = database.FindClauseByFunctor(_T("shape"));
 
325
        wxExpr *clause = database.FindClauseByFunctor(wxT("shape"));
326
326
        while (clause)
327
327
        {
328
328
                wxChar *type = NULL;
344
344
                        // If child of composite, link up
345
345
                        if (parentId > -1)
346
346
                        {
347
 
                                wxExpr *parentExpr = database.HashFind(_T("shape"), parentId);
 
347
                                wxExpr *parentExpr = database.HashFind(wxT("shape"), parentId);
348
348
                                if (parentExpr && parentExpr->GetClientData())
349
349
                                {
350
350
                                        wxShape *parent = (wxShape *)parentExpr->GetClientData();
358
358
                if (type)
359
359
                        delete[] type;
360
360
 
361
 
                clause = database.FindClauseByFunctor(_T("shape"));
 
361
                clause = database.FindClauseByFunctor(wxT("shape"));
362
362
        }
363
363
        return;
364
364
}
366
366
void wxDiagram::ReadLines(wxExprDatabase &database)
367
367
{
368
368
        database.BeginFind();
369
 
        wxExpr *clause = database.FindClauseByFunctor(_T("line"));
 
369
        wxExpr *clause = database.FindClauseByFunctor(wxT("line"));
370
370
        while (clause)
371
371
        {
372
372
                wxString type;
373
373
                long parentId = -1;
374
374
 
375
 
                clause->GetAttributeValue(_T("type"), type);
376
 
                clause->GetAttributeValue(_T("parent"), parentId);
 
375
                clause->GetAttributeValue(wxT("type"), type);
 
376
                clause->GetAttributeValue(wxT("parent"), parentId);
377
377
                wxClassInfo *classInfo = wxClassInfo::FindClass(type);
378
378
                if (classInfo)
379
379
                {
385
385
 
386
386
                        long image_to = -1;
387
387
                        long image_from = -1;
388
 
                        clause->GetAttributeValue(_T("to"), image_to);
389
 
                        clause->GetAttributeValue(_T("from"), image_from);
 
388
                        clause->GetAttributeValue(wxT("to"), image_to);
 
389
                        clause->GetAttributeValue(wxT("from"), image_from);
390
390
 
391
 
                        wxExpr *image_to_expr = database.HashFind(_T("shape"), image_to);
 
391
                        wxExpr *image_to_expr = database.HashFind(wxT("shape"), image_to);
392
392
 
393
393
                        if (!image_to_expr)
394
394
                        {
395
395
                                // Error
396
396
                        }
397
 
                        wxExpr *image_from_expr = database.HashFind(_T("shape"), image_from);
 
397
                        wxExpr *image_from_expr = database.HashFind(wxT("shape"), image_from);
398
398
 
399
399
                        if (!image_from_expr)
400
400
                        {
416
416
                        m_shapeList->Append(shape);
417
417
                }
418
418
 
419
 
                clause = database.FindClauseByFunctor(_T("line"));
 
419
                clause = database.FindClauseByFunctor(wxT("line"));
420
420
        }
421
421
}
422
422
 
426
426
void wxDiagram::ReadContainerGeometry(wxExprDatabase &database)
427
427
{
428
428
        database.BeginFind();
429
 
        wxExpr *clause = database.FindClauseByFunctor(_T("shape"));
 
429
        wxExpr *clause = database.FindClauseByFunctor(wxT("shape"));
430
430
        while (clause)
431
431
        {
432
432
                wxShape *image = (wxShape *)clause->GetClientData();
436
436
                        wxExpr *divisionExpr = NULL;
437
437
 
438
438
                        // Find the list of divisions in the composite
439
 
                        clause->GetAttributeValue(_T("divisions"), &divisionExpr);
 
439
                        clause->GetAttributeValue(wxT("divisions"), &divisionExpr);
440
440
                        if (divisionExpr)
441
441
                        {
442
442
                                int i = 0;
444
444
                                while (idExpr)
445
445
                                {
446
446
                                        long divisionId = idExpr->IntegerValue();
447
 
                                        wxExpr *childExpr = database.HashFind(_T("shape"), divisionId);
 
447
                                        wxExpr *childExpr = database.HashFind(wxT("shape"), divisionId);
448
448
                                        if (childExpr && childExpr->GetClientData())
449
449
                                        {
450
450
                                                wxDivisionShape *child = (wxDivisionShape *)childExpr->GetClientData();
455
455
                                                long topSideId = -1;
456
456
                                                long rightSideId = -1;
457
457
                                                long bottomSideId = -1;
458
 
                                                childExpr->GetAttributeValue(_T("left_side"), leftSideId);
459
 
                                                childExpr->GetAttributeValue(_T("top_side"), topSideId);
460
 
                                                childExpr->GetAttributeValue(_T("right_side"), rightSideId);
461
 
                                                childExpr->GetAttributeValue(_T("bottom_side"), bottomSideId);
 
458
                                                childExpr->GetAttributeValue(wxT("left_side"), leftSideId);
 
459
                                                childExpr->GetAttributeValue(wxT("top_side"), topSideId);
 
460
                                                childExpr->GetAttributeValue(wxT("right_side"), rightSideId);
 
461
                                                childExpr->GetAttributeValue(wxT("bottom_side"), bottomSideId);
462
462
                                                if (leftSideId > -1)
463
463
                                                {
464
 
                                                        wxExpr *leftExpr = database.HashFind(_T("shape"), leftSideId);
 
464
                                                        wxExpr *leftExpr = database.HashFind(wxT("shape"), leftSideId);
465
465
                                                        if (leftExpr && leftExpr->GetClientData())
466
466
                                                        {
467
467
                                                                wxDivisionShape *leftSide = (wxDivisionShape *)leftExpr->GetClientData();
470
470
                                                }
471
471
                                                if (topSideId > -1)
472
472
                                                {
473
 
                                                        wxExpr *topExpr = database.HashFind(_T("shape"), topSideId);
 
473
                                                        wxExpr *topExpr = database.HashFind(wxT("shape"), topSideId);
474
474
                                                        if (topExpr && topExpr->GetClientData())
475
475
                                                        {
476
476
                                                                wxDivisionShape *topSide = (wxDivisionShape *)topExpr->GetClientData();
479
479
                                                }
480
480
                                                if (rightSideId > -1)
481
481
                                                {
482
 
                                                        wxExpr *rightExpr = database.HashFind(_T("shape"), rightSideId);
 
482
                                                        wxExpr *rightExpr = database.HashFind(wxT("shape"), rightSideId);
483
483
                                                        if (rightExpr && rightExpr->GetClientData())
484
484
                                                        {
485
485
                                                                wxDivisionShape *rightSide = (wxDivisionShape *)rightExpr->GetClientData();
488
488
                                                }
489
489
                                                if (bottomSideId > -1)
490
490
                                                {
491
 
                                                        wxExpr *bottomExpr = database.HashFind(_T("shape"), bottomSideId);
 
491
                                                        wxExpr *bottomExpr = database.HashFind(wxT("shape"), bottomSideId);
492
492
                                                        if (bottomExpr && bottomExpr->GetClientData())
493
493
                                                        {
494
494
                                                                wxDivisionShape *bottomSide = (wxDivisionShape *)bottomExpr->GetClientData();
502
502
                        }
503
503
                }
504
504
 
505
 
                clause = database.FindClauseByFunctor(_T("shape"));
 
505
                clause = database.FindClauseByFunctor(wxT("shape"));
506
506
        }
507
507
}
508
508
 
528
528
                while (node)
529
529
                {
530
530
                        wxShape *childShape = (wxShape *)node->GetData();
531
 
                        wxExpr *childExpr = new wxExpr(_T("shape"));
 
531
                        wxExpr *childExpr = new wxExpr(wxT("shape"));
532
532
                        OnShapeSave(db, *childShape, *childExpr);
533
533
                        node = node->GetNext();
534
534
                }