Exemplo n.º 1
0
bool _HYPlatformWindow::_Close(Ptr theData)
{
    _HYWindow* theParent = (_HYWindow*)this;
    bool       doit = theParent->ConfirmClose();

    if (doit)
    {
        long f = windowObjects.Find((long)this);
        if (f>=0)
        {
            windowObjects.Delete(f);
            windowPtrs.Delete(f);
            windowObjectRefs.Delete(f);
        }
        if (!theData)
            gtk_object_destroy (GTK_OBJECT(theWindow));

        if (windowPtrs.lLength == 0)
            gtk_main_quit();
    }

    return doit;
}
Exemplo n.º 2
0
//__________________________________________________________________________________
void  InsertVar (_Variable* theV)
{
    long pos = variableNames.Insert (theV->theName);

    /*if (theV->GetName()->Equal (&_String("PS_2")))
    {
        printf ("Making...\n");
    }*/


    if (pos < 0 && isDefiningATree > 1)
        // automatically fix duplicate autogenerated tree node name
    {
        long trySuffix  = 1;
        _String * tryName = new _String;
        do {
            *tryName = *theV->theName & "_" & trySuffix;
            pos      = variableNames.Insert (tryName);
            trySuffix ++;
        } while (pos < 0);
        DeleteObject(theV->theName);
        theV->theName = tryName;
    }

    if (pos < 0) {
        if (isDefiningATree == 1) {
            _String errMsg (*theV->GetName());
            errMsg = errMsg& " is already being used - please rename one of the two variables.";
            WarnError(errMsg);
        }

        theV->theIndex = variableNames.GetXtra(-pos-1);
        return;
    } else {
        theV->theName->nInstances++;
    }

    if (freeSlots.lLength) {
        theV->theIndex = freeSlots.lData[freeSlots.lLength-1];
        variablePtrs[theV->theIndex]=theV->makeDynamic();
        freeSlots.Delete(freeSlots.lLength-1);
    } else {
        theV->theIndex = variablePtrs.lLength;
        variablePtrs&&theV;
    }
    variableNames.SetXtra (pos, theV->theIndex);
}