示例#1
0
KVLVEntry::~KVLVEntry()
{
   // Dtor
   // disconnect fUserData object's Modified signal from our Refresh method if connected
   delete [] fBoolean;
   if (fDisconnectRefresh && fUserData) {
      TObject* obj = (TObject*)fUserData;
      if (obj && obj->TestBit(kNotDeleted)) gInterpreter->Execute(obj, obj->IsA(), "Disconnect",
               Form("\"Modified()\",(KVLVEntry*)%ld,\"Refresh()\"", (ULong_t)this));
   }
}
示例#2
0
void KVLVContainer::OpenContextMenu(TGFrame* f, Int_t but, Int_t x, Int_t y)
{
    // Open context menu when user right-clicks an object in the list.
    // Calling AllowContextMenu(kFALSE) will disable this.
    // We also fill the list fPickOrderedObjects with the selected objects
    // in the order of clicking
    //
    // if fUseObjLabelAsRealClass=kTRUE (and if objects inherit from KVBase)
    // then the context menu opened will be that of the class given by
    // KVBase::GetLabel. The object's KVBase::GetObject() method must
    // return the real object to use.

    if (but == kButton1) {
        TGLVEntry* el = (TGLVEntry*)f;
        TObject* ob = (TObject*)el->GetUserData();
        if (!fControlClick || !GetMultipleSelection()) fPickOrderedObjects->Clear();
        if (ob) {
            Bool_t in_list = fPickOrderedObjects->FindObject(ob);
            if (in_list) fPickOrderedObjects->Remove(ob);
            else fPickOrderedObjects->AddLast(ob);
        }
        return;
    }

    // context menus globally disabled and no exceptions defined
    if (!fAllowContextMenu && !fContextMenuClassExceptions) return;

    if (but == kButton3) {
        //        Error("OpenContextMenu","x=%d y=%d",x,y);
        //        fContextMenu->Popup(x,y,this); return;

        TGLVEntry* el = (TGLVEntry*)f;
        TObject* ob = (TObject*)el->GetUserData();
        if (ob) {

            TObject* CMob = ob;
            TString CMobClass = ob->ClassName();

            if (fUseObjLabelAsRealClass && ob->TestBit(KVBase::kIsKaliVedaObject)) {
                KVBase* bob = dynamic_cast<KVBase*>(ob);
                CMobClass = bob->GetLabel();
                CMob = bob->GetObject();
            }
            // check class context menu status
            if (fContextMenuClassExceptions) {
                if ((!fAllowContextMenu && fContextMenuClassExceptions->FindObject(CMobClass))
                        || (fAllowContextMenu && !fContextMenuClassExceptions->FindObject(CMobClass)))
                    fContextMenu->Popup(x, y, CMob);
            } else if (fAllowContextMenu)  fContextMenu->Popup(x, y, CMob);
        }
    }
}
示例#3
0
void KVLVContainer::FillList(const TCollection* l)
{
    // Fill list from list
    // Pointers to objects are stored in internal list fUserItems for Refresh()

    if (l) {
        fUserItems->Clear();
    }

    if (l && !l->GetSize()) return;

    TCollection* theList = (TCollection*)(l ? l : fUserItems);
    TIter nxt(theList);
    TObject* obj = 0;
    while ((obj = nxt())) {
        if (l) fUserItems->Add(obj);
        KVLVEntry* ent;
        if (fUseObjLabelAsRealClass && obj->TestBit(KVBase::kIsKaliVedaObject))
            ent = new KVLVEntry(obj, dynamic_cast<KVBase*>(obj)->GetLabel(), this, fNcols, fColData);
        else
            ent = new KVLVEntry(obj, this, fNcols, fColData);
        AddItem(ent);
    }
}
示例#4
0
void ojtable(const char *className)
{
    static int fTableOffset = 0;
    if (!fTableOffset) fTableOffset = gObjectTable->IsA()->GetDataMemberOffset("fTable");
//  gObjectTable->Print();
    TClass *kl;
    if (className && !*className) className=0;

    const char *qwe = ".*";
    if (className) qwe = className;
    TRegexp regexp(qwe);
    int regexpLen=0;

    int sz = gObjectTable->GetSize();
    int *ptr = new int[sz];
    int *idx = new int[sz];

    TObject **tab = *((TObject ***)((char*)gObjectTable+fTableOffset));
    TObject *to;
    printf ("tab %p[%d]\n",tab,sz);
    int i,num=0;
    double hSize=0;
    int    hNumb=0;
    const char *info_name = 0;
    for (i=0; i<sz; i++)
    {
        to = tab[i];
        if (!to) 						continue;
        if (!to->TestBit(TObject::kNotDeleted))  		continue;
        int hs = SizeOfH(to);
        if (hs) {
            hSize+=hs;
            hNumb++;
        }
        if (className && regexp.Index(to->ClassName(),&regexpLen)<0)	continue;
        const char *mk = StMkDeb::GetUser(to);
        if(mk && *mk) printf("%s(%p) in %s\n",to->ClassName(),to,mk);
        ptr[num++]=int(to);
    }
    printf("TH1 N=%d, Size = %g\n",hNumb,hSize);

    TMath::Sort(num,ptr,idx,0);
    int last = 0;
    printf("Selected %d objects\n",num);
    for (i=0; i<num; i++) {
        int ix = idx[i];
        to = (TObject*)ptr[ix];
        int dist = 0;
        if (i) dist = ptr[ix]-last;
        last = ptr[ix];

//    if ((int)to == 0xc94ff34) {
//       printf("Skipped %p\n",to); continue; }

        info_name = "??";
        info_name=typeid(*to).name();
        kl = to->IsA();
        printf ("%4d +%6d : obj = %p(%3d) %s::%s \tinfo=%s\n",i,dist,to,kl->Size(),kl->GetName(),to->GetName(),info_name);

        if (strcmp("TClonesArray",kl->GetName())) continue;
        TClonesArray *tcl = ((TClonesArray*)to);
        printf(" Sizes = %d %d\n",tcl->GetLast()+1,tcl->Capacity());
        tcl->ls("");




    }
    delete [] ptr;
    delete [] idx;
}