~vbursian/research-assistant/intervers

« back to all changes in this revision

Viewing changes to RAGUI/BasicNodesUI.cpp

  • Committer: Viktor Bursian
  • Date: 2013-06-06 15:10:08 UTC
  • Revision ID: vbursian@gmail.com-20130606151008-6641eh62f0lgx8jt
Tags: version_0.3.0
versionĀ 0.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#include "Navigator.h"
13
13
#include "NewNoteDlg.h"
14
14
#include "NewIntDlg.h"
15
 
#include "NewPhysValueDlg.h"
 
15
#include "DlgEditPhysValue.h"
16
16
#include "NewPhysRangeDlg.h"
17
17
namespace RA {
18
18
//------------------------------------------------------------------------------
307
307
void  sPhysValueNodeUI::MenuGenerator (psNetViewMenu                context_menu
308
308
                                      ,sNet2TreeEvolution::pcsItem  tree_item)
309
309
{
310
 
  if( tree_item->AttrValue()->TrueType() == sPhysValueNode::Type() )
 
310
//  if( tree_item->AttrValue()->TrueType() == sPhysValueNode::Type() ){
 
311
  if( sPhysValueNode::Type()->CanCast(tree_item->AttrValue().operator ->()) ){
311
312
    context_menu->Insert( new sNetViewAction
312
313
        (context_menu->parentWidget()
313
314
        ,&EditValue  ,/*checkable*/false ,/*checked*/false
314
315
        ,sNetViewMenu::tr("Edit phys.value")
315
316
        ,sNetViewMenu::tr("View and edit the real attribute")
316
317
        ));
 
318
  };
317
319
  if( sCluster::Type()->CanCast(tree_item->AttrValue().operator ->()) ){
318
320
    context_menu->AddNew->addAction( new sNetViewAction
319
321
        (context_menu->parentWidget()
337
339
                                  ,sPoint                       /*pos*/)
338
340
{
339
341
  /*! @todo{UI++} in-place editing */
340
 
  sNewPhysValueDlg             D;
341
 
  D.setWindowTitle( sNewPhysValueDlg::tr("Edit phys.value") );
342
 
  D.SetAttrName(tree_item->AttrName());
343
 
  D.SetAttrNameEnabled(false);
344
342
  sPhysValueNode::sPtr        PV(tree_item->AttrValue());
345
343
  ASSERT(PV.IsCorrect());
346
 
  D.SetValue((sPhysValue)(*PV));
 
344
  sDlgEditPhysValue             D((sPhysValue)(*PV));
 
345
  D.setWindowTitle( sDlgEditPhysValue::tr("Edit phys.value") );
 
346
  D.SetAttrName(tree_item->AttrName());
 
347
  D.SetAttrNameEnabled(false);
347
348
  if( D.exec() ){
348
349
    PV->Assign(D.Value());
349
350
  };
353
354
void  sPhysValueNodeUI::AddNew (sNet2TreeEvolution::pcsItem  tree_item
354
355
                               ,sPoint                       /*pos*/)
355
356
{
356
 
  sNewPhysValueDlg             D;
357
 
  D.setWindowTitle( sNewPhysValueDlg::tr("Add phys.value attribute") );
 
357
  sDlgEditPhysValue           D( sPhysValue() , NULL );
 
358
  D.setWindowTitle( sDlgEditPhysValue::tr("Add phys.value attribute") );
358
359
  sPhysValueNode::sPtr        NewNode;
359
360
  while( D.exec() ){
360
361
    NewNode=new sPhysValueNode(D.Value());
361
362
    if( ! tree_item->AttrValue()->
362
363
            SetAttr(sAttribute( D.AttrName() ,NewNode ,sNode::Type() )) ){
363
364
      QMessageBox::critical(NULL ,D.windowTitle()
364
 
          ,sNewPhysValueDlg::tr("Uups!  Iz-z-zya-a-a!","Insert attribute") );
 
365
          ,sDlgEditPhysValue::tr("Uups!  Iz-z-zya-a-a!","Insert attribute") );
365
366
    }else{
366
367
      break;
367
368
    };
372
373
void  sPhysValueNodeUI::InsertNew (sNet2TreeEvolution::pcsItem  tree_item
373
374
                                  ,sPoint                       /*pos*/)
374
375
{
375
 
  sNewPhysValueDlg             D;
376
 
  D.setWindowTitle( sNewPhysValueDlg::tr("Insert phys.value attribute") );
 
376
  sDlgEditPhysValue             D((sPhysValue()));
 
377
  D.setWindowTitle( sDlgEditPhysValue::tr("Insert phys.value attribute") );
377
378
  sPhysValueNode::sPtr        NewNode;
378
379
  while( D.exec() ){
379
380
    NewNode=new sPhysValueNode(D.Value());
380
381
    if( ! tree_item->Parent()->AttrValue()->
381
382
            SetAttr(sAttribute( D.AttrName() ,NewNode ,sNode::Type() )) ){
382
383
      QMessageBox::critical(NULL ,D.windowTitle()
383
 
          ,sNewPhysValueDlg::tr("Uups!  Iz-z-zya-a-a!","Insert attribute") );
 
384
          ,sDlgEditPhysValue::tr("Uups!  Iz-z-zya-a-a!","Insert attribute") );
384
385
    }else{
385
386
      break;
386
387
    };