Ejemplo n.º 1
0
void    _HYObjectInspector::NewObject (void)
{
    _HYPullDown*    p1 = (_HYPullDown*)GetCellObject (0,2);
    _HYTable*       dl = (_HYTable*)GetCellObject (HY_OBJECT_INSPECTOR_TABLE_ROW,0);
    switch (p1->GetSelection()) {
    case 0: {
        NewTreeWindow (-1);
        break;
    }
    case 2: {
        _SimpleList sel;
        dl->GetSelection (sel);
        _String*    md = nil;
        if (sel.lLength==2) {
            md = (_String*)dl->GetCellData(0,sel.lData[0]/2);
        }

        NewModel(md);
        break;
    }
    default:
        return;
    }
    BuildListOfObjects (p1->GetSelection());
}
Ejemplo n.º 2
0
bool        _HYConsoleWindow::_ProcessMenuSelection (long msel)
{
    switch (msel) {
    case HY_WINDOW_MENU_ID_FILE+1:
        SaveConsole ();
        return true;

    case 14:
        _DoPrint ();
        return true;

    case 16:
        ((_HYTextBox*)GetObject(0))->_DoUndo(true);
        return true;

    case 17:
        ((_HYTextBox*)GetObject(0))->_DoCut(true);
        return true;

    case 18:
        ((_HYTextBox*)GetObject(0))->_DoCopy(true);
        return true;

    case HY_WINDOW_MENU_ID_EDIT+5:
        ((_HYTextBox*)GetObject(0))->_DoSelectAll(true);
        return true;

    case 21:
        SetStatusLine ("Canceling");
        terminateExecution = true;
        return true;

    case 22: {
        GtkWidget * suspendItem = gtk_item_factory_get_widget_by_action(menu_items,22);
        if (!isSuspended) {
            isSuspended = true;
            SetStatusLine (empty,empty,empty,-1,HY_SL_SUSPEND);
            gtk_label_set_text (GTK_LABEL (gtk_bin_get_child(GTK_BIN(suspendItem))), "Resume");
            updateTimer = false;
            while (isSuspended) {
                gtk_main_iteration_do(true);
            }
        } else {
            isSuspended = false;
            SetStatusLine (empty,empty,empty,-1,HY_SL_RESUME);
            gtk_label_set_text (GTK_LABEL (gtk_bin_get_child(GTK_BIN(suspendItem))), "Suspend execution");
            timerStart += clock()-lastTimer;
            updateTimer = true;
        }
        return true;
    }
    case 23:
        ShowMessagesLog();
        return true;

    case 24:
        RunStandardAnalyses();
        return true;

    case 25:
        displayAbout(false);
        return true;

    case HY_WINDOW_MENU_ID_EDIT+4:
        ((_HYTextBox*)GetObject(0))->_DoClear (true,true);
        return true;

    case 27:
        HandlePreferences (globalPreferencesList,"HYPHY Preferences");
        return true;

    case 29:
        //WinExec ("hh HYPHY HELP.chm",SW_SHOWNORMAL);
        return true;

    case 30:
        if (OpenBatchFile (false)) {
            ExecuteBatchFile();
            PopFilePath();
        }
        return true;

    case 31:
        ((_HYTextBox*)GetObject(0))->_DoRedo(true);
        return true;

    case 15:
        postWindowCloseEvent (GetID());
        gtk_main_quit ();
        return true;

    case 60: // expression calculator
        if (calculatorMode) {
            _HYTextBox         *ib = (_HYTextBox*)hyphyConsoleWindow->GetObject(1);
            ib->SetText ("exit");
            hyphyConsoleWindow->ProcessEvent (generateTextEditChangeEvent(ib->GetID(),2));
            calculatorMode         = false;
            //ib->SetText (empty);
        } else {
            calculatorMode = true;
            while(calculatorMode&&ExpressionCalculator()) {}
            calculatorMode = false;
        }
        return true;

    case 61: { // execute selection
        ExecuteSelection();
        return true;
    }

    case 70: // New Tree
        NewTreeWindow(-1);
        return true;

    case 71: // New Model
        NewModel(nil);
        return true;

    case 72: // New Chart
        NewChartWindow();
        return true;

    case 73: // New Genetic Code
        NewGeneticCodeTable(0);
        return true;

    case 74: // New Database
        NewDatabaseFile(0);
        return true;

    case 80: // Open Batch File
        if (OpenBatchFile()) {
            ExecuteBatchFile ();
        }
        return true;

    case 81: // Open Data File
        OpenDataFile();
        return true;

    case 82: // Open Tree
        OpenTreeFile();
        return true;

    case 83: // Open Text
        OpenTextFile();
        return true;

    case 84: // Open Table
        OpenTable ();
        return true;

    case 85: // Open SQLite database
        OpenDatabaseFile (nil);
        return true;

    case HY_WINDOW_MENU_ID_FILE-2:
        ShowObjectInspector ();
        return true;

    default: {
        msel -= 1000;
        if (msel<availablePostProcessors.lLength) {
            ExecuteAPostProcessor (*(_String*)(*(_List*)availablePostProcessors(msel))(1));
            return 0;
        }

        msel-=1000;
        if (msel<(long)recentPaths.lLength) {
            if (msel == -1) {
                for (long mi=0; mi<recentFiles.lLength; mi++) {
                    GtkWidget * recFile = gtk_item_factory_get_widget_by_action(hyphyConsoleWindow->menu_items,2000+mi);
                    if (recFile) {
                        gtk_item_factory_delete_item(hyphyConsoleWindow->menu_items,gtk_item_factory_path_from_widget(recFile));
                    }
                }
                recentPaths.Clear();
                recentFiles.Clear();
            } else {
                if (argFileName) {
                    *argFileName = *(_String*)recentPaths(msel);
                } else {
                    argFileName = new _String (*(_String*)recentPaths(msel));
                }
                if (OpenBatchFile(false)) {
                    ExecuteBatchFile ();
                }
            }
            return true;
        }
        return true;
    }
    }

    return _HYTWindow::_ProcessMenuSelection(msel);
}