コード例 #1
0
ファイル: view.cpp プロジェクト: mongrelx/efte
int EView::ViewRoutines(ExState &/*State*/) {
    //int rc = 1;
    //RoutineView *routines;
    EModel *M;
    EBuffer *Buffer;

    M = Model;
    if (M->GetContext() != CONTEXT_FILE)
        return 0;
    Buffer = (EBuffer *)M;

    if (Buffer->Routines == 0) {
        if (BFS(Buffer, BFS_RoutineRegexp) == 0) {
            MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "No routine regexp.");
            return 0;
        }
        Buffer->Routines = new RoutineView(0, &ActiveModel, Buffer);
        if (Buffer->Routines == 0)
            return 0;
    } else {
        Buffer->Routines->UpdateList();
    }
    SwitchToModel(Buffer->Routines);
    return 1;
}
コード例 #2
0
ファイル: view.cpp プロジェクト: mongrelx/efte
int EView::OpenDir(char *Path) {
    char XPath[MAXPATH];
    EDirectory *dir = 0;

    if (ExpandPath(Path, XPath, sizeof(XPath)) == -1)
        return 0;
    {
        EModel *x = Model;
        while (x) {
            if (x->GetContext() == CONTEXT_DIRECTORY) {
                if (filecmp(((EDirectory *)x)->Path, XPath) == 0) {
                    dir = (EDirectory *)x;
                    break;
                }
            }
            x = x->Next;
            if (x == Model)
                break;
        }
    }
    if (dir == 0)
        dir = new EDirectory(0, &ActiveModel, XPath);
    SelectModel(dir);
    return 1;
}
コード例 #3
0
ファイル: view.cpp プロジェクト: mongrelx/efte
int EView::FileLast() {
    if (Model) {
        EModel *n = Model->Next;
        if (IgnoreBufferList && n && n->GetContext() == CONTEXT_BUFFERS) n = n->Next;
        SwitchToModel(n);
        return 1;
    }
    return 0;
}
コード例 #4
0
ファイル: view.cpp プロジェクト: mongrelx/efte
int EView::FilePrev() {
    if (Model) {
        EModel *n = Model->Prev;
        if (IgnoreBufferList && n && n->GetContext() == CONTEXT_BUFFERS) n = n->Prev;
        SelectModel(n);
        return 1;
    }
    return 0;
}
コード例 #5
0
ファイル: view.cpp プロジェクト: mongrelx/efte
int EView::FileSaveAll() {
    EModel *M = Model;
    while (M) {
        if (M->GetContext() == CONTEXT_FILE) {
            EBuffer *B = (EBuffer *)M;
            if (B->Modified) {
                SwitchToModel(B);
                if (B->Save() == 0) return 0;
            }
        }
        M = M->Next;
        if (M == Model) break;
    }
    return 1;
}
コード例 #6
0
ファイル: e_file.cpp プロジェクト: OS2World/APP-EDITOR-fte
EBuffer *FindFile(char *FileName) {
    EModel *M;
    EBuffer *B;
    
    M = ActiveModel;
    while (M) {
        if (M->GetContext() == CONTEXT_FILE) {
            B = (EBuffer *)M;
            if (filecmp(B->FileName, FileName) == 0) { return B; }
        }
        M = M->Next;
        if (M == ActiveModel) break;
    }
    return 0;
}
コード例 #7
0
ファイル: c_desktop.cpp プロジェクト: dmcbride/efte
int SaveDesktop(char *FileName) {
    FILE *fp;
    EModel *M;

    fp = fopen(FileName, "w");
    if (fp == 0)
        return 0;

    setvbuf(fp, FileBuffer, _IOFBF, sizeof(FileBuffer));

    fprintf(fp, DESKTOP_VER);

    M = ActiveModel;
    while (M) {
        switch (M->GetContext()) {
        case CONTEXT_FILE:
            if (M != CvsLogView) {
                EBuffer *B = (EBuffer *)M;
                fprintf(fp, "F|%d|%s\n", B->ModelNo, B->FileName);
            }
            break;

        case CONTEXT_DIRECTORY: {
            EDirectory *D = (EDirectory *)M;
            fprintf(fp, "D|%d|%s\n", D->ModelNo, D->Path);
        }
        break;
        }
        M = M->Next;
        if (M == ActiveModel)
            break;
    }
    TagsSave(fp);
    markIndex.SaveToDesktop(fp);
    fclose(fp);
    return 1;
}
コード例 #8
0
ファイル: o_buflist.cpp プロジェクト: dmcbride/efte
int BufferView::ExecCommand(int Command, ExState &State) {

    switch (Command) {
    case ExCloseActivate: {
        EModel *B;

        CancelSearch();
        B = GetBufferById(Row);
        if (B && B != this) {
            View->SwitchToModel(B);
            delete this;
            return ErOK;
        }
    }
    return ErFAIL;
    case ExBufListFileClose: {
        EModel *B = GetBufferById(Row);

        CancelSearch();
        if (B && B != this && Count > 1) {
            if (B->ConfQuit(View->MView->Win)) {
                View->DeleteModel(B);
            }
            UpdateList();
            return ErOK;
        }
    }
    return ErFAIL;
    case ExBufListFileSave: {
        EModel *B = GetBufferById(Row);

        if (B && B->GetContext() == CONTEXT_FILE)
            if (((EBuffer *)B)->Save())
                return ErOK;
    }
    return ErFAIL;

    case ExActivateInOtherWindow: {
        EModel *B = GetBufferById(Row);

        CancelSearch();
        if (B) {
            View->Next->SwitchToModel(B);
            return ErOK;
        }
    }
    return ErFAIL;
    case ExBufListSearchCancel:
        CancelSearch();
        return ErOK;
    case ExBufListSearchNext:
        // Find next matching line
        if (SearchLen) {
            int i = Row + 1;
            i = GetMatchingLine(i == BCount ? 0 : i, 1);
            // Never returns -1 since something already found before call
            Row = SearchPos[SearchLen] = i;
        }
        return ErOK;
    case ExBufListSearchPrev:
        // Find prev matching line
        if (SearchLen) {
            int i = Row - 1;
            i = GetMatchingLine(i == -1 ? BCount - 1 : i, -1);
            // Never returns -1 since something already found before call
            Row = SearchPos[SearchLen] = i;
        }
        return ErOK;
    }

    return EList::ExecCommand(Command, State);
}